function showHide(obj) {
   var div = document.getElementById(obj);
   if (div.style.display == 'none') {
     div.style.display = '';
   }
   else {
     div.style.display = 'none';
   }
}
function sea()
{
	sndr = document.getElementById("email").value;
	SetCookie('sndr', sndr, expiry,'/');
if (document.getElementById("email").readOnly == false) {
	makeReadOnly(0);
	}
	else {
	makeReadOnly(1);
	}
}
function seturl(where){
	lurl="http://peerspin.com";
	landingPgUrl = "http://www.peerspin.com/page/landing-ref1?sid="+sndrid;
}
function makeReadOnly(rostate)
{
if (rostate == 0){
	document.getElementById("statlbl").innerHTML="Update";
	document.getElementById("sndrval").innerHTML="<span id=\'sndrval\'>\<a href=\'#\' onclick=\'showshare();\'>Click to enable sharing\<\/a>\<\/span>";
	document.getElementById("email").readOnly=true;
	SetCookie('sndr', sndr, expiry,'/');
	mksndrid();
	seturl("mRO");
	}
else {
	document.getElementById("statlbl").innerHTML="Save";
	document.getElementById("email").readOnly=false;
	}
}
function uncheck()
{
document.getElementById("myCheck").checked=false;
}
function chkstat() {
	if (document.getElementById("myCheck").checked=false) {
//		alert('check box status unchecked');
	}
	else {
//		alert('check box status checked');
	}
}
function showshare(){
	if (sndrid=="null"){
	location.reload(true);
	}
	else {
	location.reload(true);
	}
}
function chkval(){
	if (GetPageCookie('sndr') == null) {
		document.getElementById("myCheck").checked=false;
		document.getElementById("email").readOnly=false;
		if (document.getElementById("statlbl").innerHTML=="Save") {
			document.getElementById("sndrval").innerHTML=" <-- enter your email and check Save";
			}
		else {	
			document.getElementById("sndrval").innerHTML="<span id=\'sndrval\'>\<a href=\'#\' onclick=\'showshare();\'>Click to enable sharing\<\/a>\<\/span>";
		}
	}
	else {
		document.getElementById("myCheck").checked=false;
		document.getElementById("email").readOnly=true;
		document.getElementById("email").value = sndr;
		document.getElementById("statlbl").innerHTML="Update";
		if	(document.getElementById("statlbl").innerHTML=="Save") {
			document.getElementById("sndrval").innerHTML="<span id=\'sndrval\'>\<a href=\'#\' onclick=\'showshare();\'>Click to enable sharing\<\/a>\<\/span>";
		}
	}
}
function mksndrid(){
	var sndridlen = sndrid.length;
	//note: if user deletes cookies, user will not send referral data and will not receive credit
	if (sndridlen < 10){
		if (getUsr != null) {
		sndrid = sndrid+'_'+getUsr.toString();
		}
		if (getName != null) {
		sndrid = sndrid+'_'+getName;
		}
	}	
	sndrid = 'a90508'+'_'+sndr+'_'+sndrid; // if sndrid == 9, we know the user is illegal
}


