function popLogin()
{
  if (document.getElementById) {
    if (document.getElementById('popLoginForm').style.display == 'block') {
      document.getElementById('popLoginForm').style.display = 'none';
    } else document.getElementById('popLoginForm').style.display = 'block';
  }
}

function closeLogin()
{
  document.getElementById('popLoginForm').style.display = 'none';
}

function checkUncheckAll(oCheckbox) {
var el, i = 0, bWhich = oCheckbox.checked, oForm = oCheckbox.form;
while (el == oForm[i++]) if (el.type == 'checkbox') el.checked = bWhich;
}

	
function doDelete(url) {
	if (!confirm("Are you sure you want to delete this?")) return;
	if (url != null) location = url;
}

 function popUpSimpleWin(URL, winwidth, winheight){
  var extwin = window.open(URL,'newWin','toolbar=0,location=0,menubar=0,status=1,resizable=1,scrollbars=1,width='+winwidth+',height='+winheight);
  extwin.opener=self;
  extwin.focus();
 }

function go_search(myform) {
  if (document.getElementById&&document.getElementById(myform)){
   thisform=document.getElementById(myform);
  	if (thisform.sitesearchRadio0.checked) {
  		thisform.action = "/reviews/ShowSearchResults.php";
  		} else {
  		thisform.action = "http://www.picosearch.com/cgi-bin/ts.pl";
 		}
  }
}

function showmethis()
{ 
	orgloc = ' ' + this.location;
	if (orgloc.indexOf("&showthis=") > -1) {lnk_str = "&showthis=";}
		else if (orgloc.indexOf("?showthis=") > -1) {
		lnk_str = "?showthis=";}
			else if (orgloc.indexOf("?") > -1) {
			lnk_str = "&showthis=";}
				else {lnk_str = "?showthis=";}
	orglocpos = orgloc.indexOf(lnk_str);
	orglocpos2 = orgloc.indexOf("&",[orglocpos+1]);
	if (orglocpos == -1) {orglocpos=orgloc.length}
	if (orglocpos2 == -1) {orglocpos2=orgloc.length}
	orgloctmp = orgloc.substring(0,orglocpos);
	orgloc = orgloctmp + lnk_str + document.showme.search_site.value + orgloc.substring(orglocpos2,orgloc.length);
location = orgloc;
}

function popUp(URL, winwidth, winheight){
  var extwin = window.open(URL,'newWin','toolbar=1,location=1,menubar=1,status=1,resizable=1,scrollbars=1,width='+winwidth+',height='+winheight);
  extwin.focus();
 }

function popUpAltWin(URL, AltWin, winwidth, winheight){
  var extwin = window.open(URL,AltWin,'toolbar=1,location=1,menubar=1,status=1,resizable=1,scrollbars=1,width='+winwidth+',height='+winheight);
  extwin.focus();
 }

 function checkage() { 
	document.register.next_register_form.value = '';
	document.register.submit_register_form.value = '';
	document.register.submit();
}

function feature_prnt() {

// alert (navigator.userAgent);
if ((navigator.userAgent.indexOf("Mozilla/3.") == -1) && (navigator.userAgent.indexOf("MSIE 4.") == -1) && (navigator.userAgent.indexOf("Mac") == -1)) {
		window.print();
		}
	}
var newWindow = null; 
function openWindow(contentURL,windowName,windowWidth,windowHeight) { 
        widthHeight = 'height=' + windowHeight + ',width=' + windowWidth + ',menubar=no,scrollbars=yes,resizable=yes,top=20,left=20';

        newWindow = window.open(contentURL,windowName,widthHeight); 

        newWindow.focus() 
} 

function closethisifopenerURLis(ifpartofURLhasthis) {
	if(self.opener.location.href.indexOf(ifpartofURLhasthis)!=-1){self.close();}
}

function closeIfPopUpWin(gotoURL) {
  if(self.opener!=null) {
    if(gotoURL) {self.opener.location=gotoURL;}
    self.opener.focus();
    self.close();
    return false; }
}
function closeWindow(orgHref) {
  if (top.self.opener){
    top.self.opener.focus();
    top.self.window.close();
  } else {
  top.location.href=orgHref;
  }
}


function setHome(id) {
	obj = document.getElementById(id);
	if (obj.value) {
			setpage.style.behavior='url(#default#homepage)';
			setpage.setHomePage('http://www.commonsensemedia.org');
	}
}


function go_sethomepage(myform) {
  if (document.getElementById&&document.getElementById(myform)){
   thisform=document.getElementById(myform);
  	if (thisform.defaulthome.checked) {
  		setHome('defaulthome');
  	}
  }
}

function Set_Cookie( name, value, expires, path, domain, secure ) 
{
	var today = new Date();
	today.setTime( today.getTime() );
	
	if ( expires )
	{
	expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	
	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
	( ( path ) ? ";path=" + path : "" ) + 
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

// this function gets the cookie, if it exists
function Get_Cookie( name ) {
	
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
	