<!--
// this is used to expand the decoration area
function decoration() {
	for (i=0;i<document.quote.optDecoration.length;i++) {
		if (document.quote.optDecoration[i].checked==true) {
			var btn=i; 
		}
	}
	if (btn == 1) {
		document.getElementById('div1').style.display = '';
	}
	if (btn == 0) {
		document.getElementById('div1').style.display = 'none';
	}
}

function validate() {
	txtName = document.quote.txtName.value;
	txtEmail = document.quote.txtEmail.value;
	txtOrganisation = document.quote.txtOrganisation.value;
	txtPhone = document.quote.txtPhone.value;
	chkQTY1 = document.quote.QTY1.value;
	myvar = 0;
	if (txtName == ""){
		alert("Please enter your name");
		document.quote.txtName.focus();
		return false;
	}
	if (txtName == "Name"){
		alert("Please enter your name");
		document.quote.txtName.focus();
		return false;
	}
	if (txtEmail == ""){
		alert("Please enter your email");
		document.quote.txtEmail.focus();
		return false;
	}
	if (txtEmail == "Email"){
		alert("Please enter your email");
		document.quote.txtEmail.focus();
		return false;
	}
	if (txtPhone == ""){
		alert("Please enter your phone");
		document.quote.txtPhone.focus();
		return false;
	}
	if (txtPhone == "Phone"){
		alert("Please enter your phone");
		document.quote.txtPhone.focus();
		return false;
	}
	if (document.quote.auddol.checked==false && document.quote.nzdol.checked==false) {
		alert("Please choose a currency");
		document.quote.auddol.focus();
		return false;
	}
}

function decoration() {
	for (i=0;i<document.quote.optDecoration.length;i++) {
		if (document.quote.optDecoration[i].checked==true) {
			var btn=i;
		}
	}
	if (btn == 1) {
		document.getElementById('div1').style.display = '';
	}
	if (btn == 0) {
		document.getElementById('div1').style.display = 'none';
	}
}

function add_email(show) {
	if (show) {
		document.getElementById('cc_email_row').style.display = '';
		document.getElementById('cc_name_row').style.display = '';
	} else {
		document.getElementById('cc_email_row').style.display = 'none';
		document.getElementById('cc_name_row').style.display = 'none';
	}
}

/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
function getType(dec,supp) {
	document.getElementById('rightcolumn').style.display = 'none';
	ajaxpage('/includes/form_controls.php?dec_id='+dec+'&sup_type='+supp, 'rightcolumn');
}
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
function ajaxpage(url, containerid) {
	var page_request = false
	if (window.XMLHttpRequest) { // if Mozilla, Safari etc
		page_request = new XMLHttpRequest();
	} else if (window.ActiveXObject) { // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try {
				page_request = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){}
		}
	} else {
		return false;
	}
	page_request.onreadystatechange=function() {
		loadpage(page_request, containerid);
	}
	page_request.open('GET', url, true);
	page_request.send(null);
}

function loadpage(page_request, containerid) {
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) {
		document.getElementById(containerid).innerHTML=page_request.responseText;
		if (page_request.responseText.length > 1) {
			document.getElementById(containerid).style.display = '';
		}
	}
}

function loadobjs() {
	if (!document.getElementById) {
		return
	}
	for (i=0; i<arguments.length; i++) {
		var file=arguments[i];
		var fileref="";
		if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
			if (file.indexOf(".js")!=-1){ //If object is a js file
				fileref=document.createElement('script');
				fileref.setAttribute("type","text/javascript");
				fileref.setAttribute("src", file);
			} else if (file.indexOf(".css")!=-1){ //If object is a css file
				fileref=document.createElement("link");
				fileref.setAttribute("rel", "stylesheet");
				fileref.setAttribute("type", "text/css");
				fileref.setAttribute("href", file);
			}
		}
		if (fileref!="") {
			document.getElementsByTagName("head").item(0).appendChild(fileref);
			loadedobjects+=file+" "; //Remember this object as being already added to page
		}
	}
}

function getElementsByName_iefix(tag, name) {
     var elem = document.getElementsByTagName(tag);
     var arr = new Array();
     for(i = 0,iarr = 0; i < elem.length; i++) {
          att = elem[i].getAttribute("name");
          if(att == name) {
               arr[iarr] = elem[i];
               iarr++;
          }
     }
     return arr;
}

function toggle_lm(i) {
	var a = document.getElementById('tgl_'+i+'_t');
	var p = 'b';
	var elms = document.getElementsByName('tgl_'+i);
	if (elms.length == 0) {
		elms = getElementsByName_iefix('tr', 'tgl_'+i);
	}
	for (j=0; j < elms.length; j++) {
		if (p == 'b') {
			if (elms[j].style.display == 'none') {
				a.innerHTML = 'Hide';
				p = '';
			} else {
				a.innerHTML = 'Show';
				p = 'none';
			}
		}
		elms[j].style.display = p;
	}
}


function pop_full_image(img) {
	window.open("http://www.promoproductscentral.com/images/products/"+img, "myWindow", "status = 0, resizable = 1 ");
}

var search_val = 'Quick Search for...';

var search_box = null;

function search_toggle(t) {
	if (t == 'blur') {
		if (search_box.value == '') {
			search_box.value = search_val;
		}
	}
	if (t == 'focus') {
		if (search_box.value == search_val) {
			search_box.value = '';
		}
	}
}

function search_toggle_focus() {
	search_toggle('focus');
}

function search_toggle_blur() {
	search_toggle('blur');
}

var init_search_v = false;
function init_search() {
	if (init_search_v == false) {
		search_box = document.getElementById('search_box');
		if (search_box) {
			search_box.value = search_val;
			search_box.onfocus = search_toggle_focus;
			search_box.onblur = search_toggle_blur;
			init_search_v = true;
		} else {
			setTimeout('init_search()', 500);
		}
	}
}
init_search();

function preload_img(src, base_url) {
	if (!base_url) {
		var base_url = 'http://www.promoproductscentral.com/images/products/';
	}
	var im = new Image();
	im.src = base_url + src;
}

function update_cart() {
	var theform = document.getElementById('sc_form');
	theform.action = "shoppingcart.php?update";
	theform.submit();
}
function sc_lookfeel(tf, span) {
	if (tf) {
		document.getElementById(span).style.backgroundColor = "#FFFFFF";		
		document.getElementById(span).style.color = "#000000";		
	} else {
		document.getElementById(span).style.color = "#FFFFFF";		
		document.getElementById(span).style.backgroundColor = "#CC0000";		
	}
}
var submit = false;
function sc_validate(al) {
	var error = false;
	
	if ((al) && (!submit)) { // Don't want to fire this until we've hit the submit button once
		return false;
	} else if ((!al) && (!submit)) {
		submit = true;
	}
	
	if (document.getElementById('contact_name')) {
		if (document.getElementById('contact_name').value == "") {
			sc_lookfeel(false, 'contact_name_label');
			error = true;
		} else {
			sc_lookfeel(true, 'contact_name_label');
		}
	} 
	if (document.getElementById('contact_email')) {
		if(echeck(document.getElementById('contact_email').value) == false) {
			sc_lookfeel(false, 'contact_email_label');
			error = true;
		}else {
			sc_lookfeel(true, 'contact_email_label');
		}
	} 
	if (document.getElementById('contact_phone')) {
		if ((document.getElementById('contact_phone').value == "") || (document.getElementById('contact_phone').value.length < 8)) {
			sc_lookfeel(false, 'contact_phone_label');
			error = true;
		}	else {
			sc_lookfeel(true, 'contact_phone_label');
		}	
	} 	
		
	if (error) {
		if (!al) {
			alert('I\m Sorry, but we\'re missing some information from you.\nPlease complete the Required Fields and try again');
		}
		return false;
	} else if (!al) {
		var theform = document.getElementById('sc_form');
		theform.action = "shoppingcart.php?checkout";
		theform.submit();
		return true;
	}
}
function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	
	if (str.indexOf(at)==-1){ return false	}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false }
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false }
	if (str.indexOf(at,(lat+1))!=-1){ return false }
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false }
	if (str.indexOf(dot,(lat+2))==-1){ return false }
	if (str.indexOf(" ")!=-1){ return false  }

	return true					
}
function showhide(id) {
	var div = document.getElementById(id.name + "_sh");
	if(id.checked) {
		div.style.display = '';
	} else {
		div.style.display = 'none';
	}
}
function checkout() {
	var theform = document.getElementById('checkoutform');
	theform.submit();
}
-->

