
// Comments 

// this function gets the expiration date of cookies

function getexpirydate(nodays)
{
  	var UTCstring;
	Today = new Date();
	nomilli=Date.parse(Today);
	Today.setTime(nomilli+nodays*24*60*60*1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}


// this function gets the cookie based on cookie name 

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));
}

// this function sets the cookie based on name, value and duration of cookie

function setcookie(name,value,duration)
{
	cookiestring=name+"="+escape(value)+";EXPIRES="+getexpirydate(duration)+";PATH=/";
	document.cookie=cookiestring;
	if(!getcookie(name)){
		return false;
	}
	else{
		return true;
	}
}

function printThis() {
	window.print();
	window.close();
}

