//////////////////////////
// POPUP WINDOW
//////////////////////////
	function popTo(URL,WIDTH,HEIGHT) {
		window.open(URL, '', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=' + WIDTH + ',height=' + HEIGHT + ',left = 262,top = 34');
	}
//////////////////////////
// GET TEMPLATE MONSTER
//////////////////////////
	AFFNAME = "littlest";
	REFERER = "littlestarweb.com";
	function popView(tempnumber) {
		var URL = "http://www.templatehelp.com/preset/pr_preview.php?pr_code=ITzmjA22VeH94l51gd9WzI2LTGmb6j&i=" + tempnumber;
		window.open(URL, '', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=502,height=550,left = 262,top = 34');
	}
	function popBuy(tempnumber) {
		var URL = "http://www.templatehelp.com/preset/cart.php?act=add&pr_code=ITzmjA22VeH94l51gd9WzI2LTGmb6j&templ=" + tempnumber;
		window.open(URL, '', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=502,height=550,left = 262,top = 34');
	}
	function popAdd(tempnumber) {
		var URL = "http://www.templatehelp.com/preset/cart.php?act=add&pr_code=ITzmjA22VeH94l51gd9WzI2LTGmb6j&templ=" + tempnumber;
		window.open(URL, '', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=502,height=550,left = 262,top = 34');
	}
	function popCustom(tempnumber) {
		var URL = "http://www.template-help.com/tuning/tuning.php?aff=" + AFFNAME + "&t_number=" + tempnumber;
		window.open(URL);
	}
//////////////////////////
// VALIDATE FORM
//////////////////////////
	function validate() {
		missinginfo = "";
		if (document.theform.realname.value == "") {
			missinginfo += "\n     -  Your Name";
		}
		if (document.theform.email.value == "") {
			missinginfo += "\n     -  Your E-mail";
		}
		if (document.theform.message.value == "") {
			missinginfo += "\n     -  Your Message";
		}
		if (missinginfo != "") {
			missinginfo ="_____________________________\n" +
			"You did not correctly fill in your:\n" +
			missinginfo + "\n_____________________________" +
			"\nPlease re-enter and submit again.";
			alert(missinginfo);
			return false;
		}
	}
//////////////////////////
// VALIDATE QUOTE FORM
//////////////////////////
	function validatequote() {
		missinginfo = "";
		if (document.thequote.YourName.value == "") {
			missinginfo += "\n     -  Your Name";
		}
		if (document.thequote.YourEmail.value == "") {
			missinginfo += "\n     -  Your E-mail";
		}
		if (document.thequote.ProjectDesign.value == "") {
			missinginfo += "\n     -  Project Description";
		}
		if (missinginfo != "") {
			missinginfo ="_____________________________\n" +
			"You did not correctly fill in your:\n" +
			missinginfo + "\n_____________________________" +
			"\nPlease re-enter and submit again.";
			alert(missinginfo);
			return false;
		}
	}
//////////////////////////
// VALIDATE Search FORM
//////////////////////////
	function searchtm() {
		isitthere = "n";
		if (document.searhfm.t.value != "") {
			isitthere = "y";
		}
		if (document.searhfm.c.value != "") {
			isitthere = "y";
		}
		if (document.searhfm.k.value != "") {
			isitthere = "y";
		}
		if (document.searhfm.i.value != "") {
			isitthere = "y";
		}
		if (document.searhfm.p1.value != "") {
			isitthere = "y";
		}
		if (document.searhfm.p2.value != "") {
			isitthere = "y";
		}		
		if (isitthere == "n") {
			missinginfo ="_____________________________\n" +
			"Please fill in at least:\n" +
			"one search option.\n" +
			"_____________________________\n" +
			"Please re-enter and submit again.";
			alert(missinginfo);
			return false;
		}
	}

/***********************************************
* Drop Down/ Overlapping Content- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

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=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
var ypos=getposOffset(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 displaydivpop(curobj, insertTxt, opt_position){
	var subobjstr = 'divpop';
	if (document.getElementById){
		var subobj=document.getElementById(subobjstr)
		subobj.style.display=(subobj.style.display!="block")? "block" : "none"
		var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
		var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
		subobj.style.left=xpos+"px"
		subobj.style.top=ypos+"px"
		document.getElementById(subobjstr).innerHTML = insertTxt;
		return false
	}
	else
		return true
}

function hidedivpop(){
var subobj = 'divpop';
document.getElementById(subobj).style.display="none"
}
