// JavaScript Document

function VerifyLogoQuest() {
	
	var txt = "";
	
	if (document.formular.username.value=="") {
	 txt = txt + "\n * Your Name";
	}
	
	if (document.formular.userphone.value=="") {
	 txt = txt + "\n * Telephone";
	}
	
	var str=document.formular.usermail.value
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i 
	if (!filter.test(str)) {
	 txt = txt + "\n * Email is not Valid";
	}
	
	if (!document.formular.termsagree.checked) {
	 txt = txt + "\n\n * You have to accept our terms and conditions";
	}
	
	if (txt) {
		alert ("The folowing fields are required:\n" + txt);
		return false;
	}

	
}

function getpos(overlay, offtype) {
	
	var totaloff=(offtype=="left")? overlay.offsetLeft : overlay.offsetTop;
	var parentEl=overlay.offsetParent;
	
	while (parentEl!=null) {
		totaloff=(offtype=="left")? totaloff+parentEl.offsetLeft : totaloff+parentEl.offsetTop;
		parentEl=parentEl.offsetParent;
	}
	
	return totaloff;
	
}

function overlay(curobj, subobjstr, opt_position) {
	
	if (document.getElementById) {
		
		var subobj=document.getElementById(subobjstr);
		subobj.style.display=(subobj.style.display!="block")? "block" : "none";
		var xpos=getpos(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0);
		var ypos=getpos(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0);
		subobj.style.left=xpos+"px";
		subobj.style.top=ypos+"px";
		return false
		
	}
	else
	return true
	
}

function overlayclose(subobj) {
	
	document.getElementById(subobj).style.display="none";
	
}

function ExpandBox() {
	document.getElementById("expandbox").style.height = 'auto';
	document.getElementById("expandboxlink").style.display = 'none';
}
