<!-- Hide

//***************************************************************************************************
function OpenPopUpWindow(pageURL, windowOptions)
	{
	 if (PopUpWindow!=null)
		{
		PopUpWindow.close();
		}

	/* sample windowOptions = "scrollbars=yes,toolbar=no,location=no,status=no,width=400,height=300" */
	var PopUpWindow = window.open('', 'popWin', windowOptions)
	PopUpWindow.location.href=pageURL;
	PopUpWindow.focus();
	}
//***************************************************************************************************

//***************************************************************************************************
function OpenNewPopUpWindow(pageURL, windowOptions, objSelected, objName, frmName)
	{
	 if (NewPopUpWindow!=null)
		{
		NewPopUpWindow.close();
		}
	/* sample windowOptions = "scrollbars=yes,toolbar=no,location=no,status=no,width=400,height=300" */
	var NewPopUpWindow = window.open('', 'NewpopWin', windowOptions)
	NewPopUpWindow.location.href=pageURL + '?text=' + objSelected + '&objSelected=' + objName + '&frmName=' + frmName;
	NewPopUpWindow.focus();
	}
//***************************************************************************************************


// UnHide -->
function showPreview(img) {
	window.open("preview.php?id="+img,"popup","scrollbars=yes,location=0,directories=0,menubar=0,status=0,width=40,height=32,resize=yes");
}
function CheckPrice(value){
	if(isNaN(value)){
		document.getElementById('error').style.display='';
		document.form1.Qty.focus();
	}else{
		document.getElementById('error').style.display	='none';
	}
}
function change_price(cbk_val)
{
	var val = cbk_val.split('##');
	document.getElementById('td_product_price').innerHTML = '$'+val[1];
}

function fetch_products(cat_id,div_id,div_sizes)
{
	$(div_id).innerHTML = 'Loading, please wait ...';
	var url = 'ajax.php';
	var params = 'pid=2&cat_id='+ cat_id +'&div_sizes='+div_sizes+'&rnd='+Math.random();
	var myAjax = new Ajax.Updater(div_id,url, {method: 'get', parameters: params});
}

function fetch_sizes(product_id,div_id)
{
	$(div_id).innerHTML = 'Loading, please wait ...';
	var url = 'ajax.php';
	var params = 'pid=1&product_id='+ product_id +'&rnd='+Math.random();
	var myAjax = new Ajax.Updater(div_id,url, {method: 'get', parameters: params});
}

function validate_multi_cart(frm)
{
	var error = true;
	for(var i = 0 ; i < frm.elements.length ; i++)
	{
		var e = frm.elements[i];
		if(e.type == 'checkbox' && e.checked)
			error = false;
	}
	if(error)
	{
		alert('Please select any product to continue.');
		return false;
	}
}

function openwin(theURL,winName,features,w,h)
{
	var subwin = window.open(theURL,winName,features);
	var x,y;	
	x = (Number(screen.width) - w) / 2;
	y = 125;
	subwin.moveTo(x,y);
	subwin.focus();
}


function set_same(d){

	if(d.same.checked == true){
			d.sp_first_name.value	= d.bl_first_name.value;
			d.sp_last_name.value	= d.bl_last_name.value;
			d.sp_address1.value 	= d.bl_address1.value;
			d.sp_address2.value 	= d.bl_address2.value;
			//d.sp_suburb.value 		= d.bl_suburb.value;
			d.sp_post_code.value 	= d.bl_post_code.value;
			d.sp_city.value 		= d.bl_city.value;
			d.sp_state.value 		= d.bl_state.value;
			
			if(d.bl_non_us.checked)
			{
				d.sp_non_us.checked = true;
				d.sp_state.disabled = true;
			}
			
			var ct 					= d.bl_country.selectedIndex;
			
			d.sp_country.options[ct].selected = true;
			d.sp_phone.value 		= d.bl_phone.value;
			d.sp_mobile.value 		= d.bl_mobile.value;
			d.sp_fax.value 			= d.bl_fax.value;
			d.sp_email.value 		= d.bl_email.value;
			//alert(d.bl_country.selectedIndex);
			//alert(d.sp_country.selectedIndex);
		}
	else{
			d.sp_first_name.value	= "";
			d.sp_last_name.value	= "";
			d.sp_address1.value 	= "";
			d.sp_address2.value 	= "";
			//d.sp_suburb.value 		= "";
			d.sp_post_code.value 	= "";
			d.sp_city.value 		= "";
			d.sp_state.disabled = false;
			d.sp_state.value 		= "";
			d.sp_country.options[0].selected = true;
			d.sp_non_us.checked = false;
			
			d.sp_phone.value 		= "";
			d.sp_mobile.value 		= "";
			d.sp_fax.value 			= "";
			d.sp_email.value 		= "";
		
		}

}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

