

function getcookie(cookiename) {

 var cookiestring=""+document.cookie;

 var index1=cookiestring.indexOf(cookiename);

 if (index1==-1 || cookiename=="") return ""; 

 var index2=cookiestring.indexOf(';',index1);

 if (index2==-1) index2=cookiestring.length; 

 return unescape(cookiestring.substring(index1+cookiename.length+1,index2));

}





function SetCookieSwtich(name, value, expires, path, domain) 

{ document.cookie = name + "=" + escape(value) + 

  ((expires == null) ? "" : "; expires=" + expires.toGMTString()) +

  ((path == null)    ? "" : "; path=" + path) +

  ((domain == null)  ? "" : "; domain=" + domain);

}

////////////////////////////////////////////



////Function to delete a cookie//

function Delete_Cookie(name,path,domain) { 

   if (getcookie(name)) document.cookie = name + "=" + 

      ( (path) ? ";path=" + path : "") + 

      ( (domain) ? ";domain=" + domain : "") + 

      ";expires=Thu, 01-Jan-70 00:00:01 GMT"; 

} 





///Set switch back cookie

function setSwitchBack()

{

  var cLocation

  var chkcookie=getcookie('switchback');

  var tabstater

  

  //In here lets get the tabstate name

  

  

  var themename=getcookie('tbstate');

 

 if(themename=='')

 {

  var rcookievalue=(persisttype=="sitewide")? tabsourceindex+"|"+previoustab+";path=/" : tabsourceindex+"|"+previoustab

 }

  

  switch (rcookievalue)

  {

	case '0|sc1':

	themename=''

	break

	

	case '0|sc2':

	themename='blogeagle'

	break

	

	case '0|sc3':

	themename='presspanther'

	break

	

    case '0|sc4':

	themename='brandprobe'

	break

	

	case '0|sc5':

	themename='media'

	break

	



  }

 

  

 

  

  var expirationSwitch = new Date();

  expirationSwitch.setTime(expirationSwitch.getTime() + 24 * 60 * 60 * 1000);

  

  cLocation=document.location.href;

  

  if(cLocation=="http://www.reputrace.com/psearch/cgi-bin/nph.fcgi")

  {

     var catgry=themename;

	 var themename=themename;

	 

    var qrystr=document.getElementById('qry_str').value;



	cLocation='';

	 var cLocation = 'http://www.reputrace.com/psearch/cgi-bin/nph.fcgi?qry_str=' + qrystr + '&category=' + catgry + '&theme=' + themename;

  }

  

 if(cLocation=='')

 {

	cLocation=="http://www.reputrace.com/psearch/cgi-bin/nph.fcgi";   

 }

	 



  

  

  if(chkcookie!=null)

  {

	Delete_Cookie('switchback','/','.reputrace.com')	

	SetCookieSwtich('switchback', cLocation, expirationSwitch, '/' , '.reputrace.com')

  }

  

 if(!chkcookie)

  {  

     Delete_Cookie('switchback','/','.reputrace.com')	 

	 SetCookieSwtich('switchback', cLocation, expirationSwitch, '/' , '.reputrace.com')

  }

}





function addLoadEvent(func) {

    var oldonload = window.onload;

    if (typeof window.onload != 'function') {

        window.onload = func;

    } else {

        window.onload = function() {

            oldonload();

            func();

        }

    }

}



function setLabelText(ID, Text)

  {

    document.getElementById(ID).innerHTML = Text;

  }







addLoadEvent(function() {

  var cooke=getcookie("usrep");

  

  if (cooke!=''){

  	  setLabelText("accountname", cooke);

  }

  else

  {

	   window.location="http://www.reputrace.com/login";

  }

  

})







    addLoadEvent(function() {

						  

	if(document.getElementById('contentfrme')){						  

	  var framedisp=window.inlineframe1.test_var;

	  

    if (framedisp=="none"){

		  //alert(framedisp);return false;

		  //document.ifrOne.class="rgm2"

		 document.getElementById('contentfrme').style.display="none"

	  }

	}

	})





























