// JavaScript Document
function getCookie(NameOfCookie)
{ if (document.cookie.length > 0) 
{ begin = document.cookie.indexOf(NameOfCookie+"="); 
if (begin != -1) 
{ begin += NameOfCookie.length+1; 
end = document.cookie.indexOf(";", begin);
if (end == -1) end = document.cookie.length;
return unescape(document.cookie.substring(begin, end)); } 
}
return null; 
} 
 
 
function checkCookie (book)
{
 	var preference = getCookie('TTP2Version');
 	
 	if (preference==null) 
 	{
 	  
 	  //location.href = '/onlinegallery/ttp/confirmation.html?book=' + book
		window.open('/onlinegallery/ttp/confirmation.html?book=' + book,null,
    "height=300,width=667,status=yes,toolbar=no,menubar=no,location=no,resizable=yes,scrollbars=yes");
	}
 	else
 	{
 		
 		launchTTP (book,preference)
	}
}


function setCookie(NameOfCookie, value, expiredays) 
{
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}
