var cookies=new CookieUtil("PETROEDLEARN",0);

function goSearch(){
	if(form1.searchText.value.length>0){
		form1.action="search.asp"
		form1.submit();
	}else{
		alert("Please provide search criteria.");
	}
}

function showEula(){
	window.open('eula.htm','mywin','width=500,height=500,scrollbars=1,toolbar=0,resizable=0');
}

function showRequirements(){
	window.open('requirements.htm','mywin','width=650,height=400,scrollbars=1,toolbar=0,resizable=0');
}

function launchDemo(d){
	window.open('demo.asp?dbid='+d,'demo','width=500,height=250,scrollbars=1,toolbar=0,resizable=0');
}

function AddToCart(f){
	//no EULA
	//f.submit();
	//return;
	//alert(!cookies.getSubValue("TMIELEARN"))
	if(!cookies.getSubValue("TMIELEARN")){
		document.getElementById("panel").style.display="none";
		document.getElementById("eula").style.display="block";
		if(document.getElementById("eulaText").scrollHeight<350){
			//no need to scroll to bottom (350 + 30 padding);
			document.getElementById("accept").disabled=false;
			document.getElementById("decline").disabled=false;
		}
	}else{
		f.submit();
	}
}

function dm_AddToCart(f){
	f.submit();
}


function checkEULA(){
	var objDiv = document.getElementById("eulaText");
	if((objDiv.offsetHeight+objDiv.scrollTop)>= objDiv.scrollHeight){
		document.getElementById("accept").disabled=false;
		document.getElementById("decline").disabled=false;
	}else{
		document.getElementById("accept").disabled=true;
		document.getElementById("decline").disabled=true;
	}
}

function acceptEula(f){
	cookies.setSubValue("TMIELEARN",1);
	f.submit();
}

function declineEula(){
	document.getElementById("panel").style.display="block";
	document.getElementById("eula").style.display="none";
}
