﻿// JScript File to check for login credentials
function getQs(q){
my_u=window.location.split("?");
return my_u[0];
}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=")
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1 
    c_end=document.cookie.indexOf(";",c_start)
    if (c_end==-1) c_end=document.cookie.length
    return unescape(document.cookie.substring(c_start,c_end))
    } 
  }
return ""
}

function checkCookie()
{
username=getCookie('UserName')
if (username!=null && username!="")
  {
  return (username);
  }
} 

function menuCk()
{
username=checkCookie('UserName')
if (username!=null && username!="")
  {
  return ("<a href='loginwelcome.htm'>DASHBOARD</a>");
  }
else 
  {
  return ("<a href='login.htm'>LOGIN</a>");
  
  }
} 


function logOut(cookie_name) {
	    var cookie_date = new Date ( );  // current date & time
          cookie_date.setTime ( cookie_date.getTime() - 1 );
          document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
          window.location.href="http://www.rememberapol.com";
	    }


function setVisible(obj)
{
	obj = document.getElementById(obj);
	obj.style.visibility = (obj.style.visibility == 'visible') ? 'hidden' : 'visible';
}
function placeIt(obj)
{
	obj = document.getElementById(obj);
	refObj = document.getElementById("Runningfor")
	var x = AnchorPosition_getPageOffsetLeft(refObj) + 150
    var y = AnchorPosition_getPageOffsetTop(refObj)
    
	if (document.documentElement)
	{
		theLeft = document.documentElement.scrollLeft;
		theTop = document.documentElement.scrollTop;
	}
	else if (document.body)
	{
		theLeft = document.body.scrollLeft;
		theTop = document.body.scrollTop;
	}

	obj.style.left = x + 'px' ;
	obj.style.top = y + 'px' ;
	setTimeout("placeIt('layer1')",500);
}

 
  function chgRF(ind) {
  if (document.getElementById("selRun").options[ind].value!="Other") {
 document.getElementById("Runningfor").value = document.getElementById("selRun").options[ind].value;
 }
    else { document.getElementById("Runningfor").style.visibility="visible"
 }
}
