function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);{
}
}

function checkrequired(which){
var pass=true
if (document.images){
for (i=0;i<which.length;i++){
var tempobj=which.elements[i]
if (tempobj.name.substring(0,8)=="required"){
if (((tempobj.type=="text"||tempobj.type=="textarea")&&tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&tempobj.selectedIndex==-1)){
pass=false
break
}
}
}
}
if (!pass){
alert("One or more of the required elements are not completed. Please complete them, then submit again!")
return false
}
else
return true
}


function CalculateTotalOrder(){
	var i; //Counter
	var strSplit; //Spliter
	var fltTotal; //Total Order
	
	//Initialise Variable
	fltTotal = 0.00;

	for(i=0;i<document.OrderForm.elements.length;i++){
		if(document.OrderForm.elements[i].type == 'checkbox'){
			if (document.OrderForm.elements[i].checked == true){
				//Find Numeric value
				strSplit = (document.OrderForm.elements[i].value).split("$");
				fltTotal = parseFloat(strSplit[1]) + fltTotal;
			}
		}else if(document.OrderForm.elements[i].name == 'select'){
			if((document.OrderForm.elements[i].value != 'Ring for pricing')&&(document.OrderForm.elements[i].value != '')){
				//Find Nemeric Value
				strSplit = (document.OrderForm.elements[i].value).split("$");
				fltTotal = parseFloat(strSplit[1]) + fltTotal;
			}
		}else if(document.OrderForm.elements[i].name == 'DeliveryCharges'){
			if((document.OrderForm.elements[i].value != '') && (document.OrderForm.elements[i].value != 'Free')){
				//Find Nemeric Value
				strSplit = (document.OrderForm.elements[i].value).split("$");
				fltTotal = parseFloat(strSplit[1]) + fltTotal;
			}
		}
	}
		//Convert Number to String
		fltTotal = fltTotal+'';
		//Is it a whole number
		if (fltTotal.indexOf(".") == -1){
			totalPrice.innerHTML ="<p align='center'><font face='Georgia' size='4'><b>Totals</b></p><font size='2' face='Georgia'></b></p><hr><p align='center'><b>Total Payment Due (Including Delivery):</b> $" + fltTotal + ".00</p><hr>";
		}else{
			totalPrice.innerHTML ="<p align='center'><font face='Georgia' size='4'><b>Totals</b></p><font size='2' face='Georgia'></b></p><hr><p align='center'><b>Total Payment Due (Including Delivery):</b> Total: $" + Math.round(fltTotal*Math.pow(10,2))/Math.pow(10,2)+"<hr>";
		}
		//Go to the end of the page
		document.all.godown.scrollIntoView(); 

}

function ClearTotalOrder(){
	totalPrice.innerHTML = "";
}


function GetTime() { 
var dt = new Date();
var def = dt.getTimezoneOffset()/60;
var gmt = (dt.getHours() + def);
document.clock.local.value = (IfZero(dt.getHours()) + ":" + IfZero(dt.getMinutes()) + ":" + IfZero(dt.getSeconds()));
var ending = ":" + IfZero(dt.getMinutes()) + ":" +  IfZero(dt.getSeconds());
var sdn =check24(((gmt + 10) > 24) ? ((gmt + 10) - 24) : (gmt + 10));
document.clock.sdn.value = (IfZero(sdn) + ending);

setTimeout("GetTime()", 1000);
}
function IfZero(num) {
return ((num <= 9) ? ("0" + num) : num);
}
function check24(hour) {
return (hour >= 24) ? hour - 24 : hour;
}

