

function btover(btnval) {
filename='images/navbtn/'+btnval+'OVER.gif';
overim='IMAGE'+btnval+'OVER';
document.images[btnval].src=filename;
}



function btdown(btnval) {
filename='images/navbtn/'+btnval+'DOWN.gif';
document.images[btnval].src=filename;
}

function btmain(btnval) {
filename='images/navbtn/'+btnval+'MAIN.gif';
document.images[btnval].src=filename;
}



function blockEnter(ent) {

if (ent==13) {
alert ("Please press the plus sign, or tab key to confirm quantity inforamtion. Thank you.");
return false;

}
}



/////////// HARDWARE ORDERS



function blockEnter(ent) {
entr=ent.keyCode;
//alert("checking"+entr);
if (entr==13) {
alert ("The ENTER key is disabled. Please use the PLUS button (or TAB) to update quantities. Thank you.");
return false;
}
}



function getCategory() {
nocategory=window.orderform.category.value;
checkme=window.orderform.session.value;
 if (checkme==1) {
 orderform.submit();
 }
 else
 {
nosessions=window.notebook.session.value;

window.notebook.session.value=parseInt(nosessions)+1;
oneupsession=parseInt(nosessions);
nosessions=parseInt(nosessions)-2;
//alert(nosessions+"here");
newlocation='hardware.php?session='+oneupsession+'&category='+nocategory;

if (nosessions==0) {
newlocation=newlocation+"&transpid[0]="+notebook.transpid[0].value+"&transqty[0]="+notebook.transqty[0].value;
	}else{
for (var loop=0; loop<=nosessions; loop++) {
newlocation=newlocation+"&transpid["+loop+"]="+notebook.transpid[loop].value+"&transqty["+loop+"]="+notebook.transqty[loop].value;
	}

 }

window.location=newlocation;

}

}





function updateMe(identity,itemno) {


nosessions=notebook.session.value;
nocategory=notebook.category.value;



valuex=parseInt(window.leftform.qty[itemno].value);


if (isNaN(valuex)) {
alert ("Please enter a number!");
window.leftform.qty[itemno].value="";
window.leftform.qty[itemno].focus();
return;
} 

if (valuex==0) {
alert ("You must order something to continue!");
window.leftform.qty[itemno].value="";
window.leftform.qty[itemno].focus();
return;
} 

if ((valuex>=4)||(nosessions>=8)) {
alert ("That you for choosing SiteSource. We would like to offer you a bulk discount! Please call 02 8399 2035 during business hours to place your order.");
window.leftform.qty[itemno].value="";
window.leftform.qty[itemno].focus();
return;
}

linknum=nosessions-1;

qtyentered=leftform.qty[itemno].value;

//alert(nosessions+" made it "+identity+"  "+qtyentered);

if (nosessions==1){
window.notebook.transpid.value=identity;
window.notebook.transqty.value=qtyentered;
} else {
window.notebook.transpid[linknum].value=identity;
window.notebook.transqty[linknum].value=qtyentered;
}

//alert("here we go");
window.notebook.session.value=parseInt(nosessions)+1;
oneupsession=parseInt(nosessions)+1;
nosessions=parseInt(nosessions)-1;

newlocation='hardware.php?session='+oneupsession+'&category='+nocategory;

if (nosessions==0) {
newlocation=newlocation+"&transpid[0]="+notebook.transpid.value+"&transqty[0]="+notebook.transqty.value;
}else{
for (var loop=0; loop<=nosessions; loop++) {
newlocation=newlocation+"&transpid["+loop+"]="+notebook.transpid[loop].value+"&transqty["+loop+"]="+notebook.transqty[loop].value;
}
} //else nosessions=2

//alert(newlocation);
window.location=newlocation

//notebook.submit();

}


function plusItem(vart1,vart2) {
//alert (window.leftform.qty[vart2].value+"brr");
if (window.leftform.qty[vart2].value=="") {
  window.leftform.qty[vart2].value="1";
  updateMe(vart1,vart2);
 }
}


function updateLocate(nosessions) {


nocategory=window.notebook.category.value;

linknum=nosessions-2;

//alert (linknum);
//alert (nosessions);
newlocation='hardware.php?session='+nosessions+'&category='+nocategory;

if (linknum==-1) {
//newlocation=newlocation+"&transpid="+window.notebook.transpid.value+"&transqty="+window.notebook.transqty].value;
}else{
for (var loop=0; loop<=linknum; loop++) {
newlocation=newlocation+"&transpid["+loop+"]="+window.notebook.transpid[loop].value+"&transqty["+loop+"]="+window.notebook.transqty[loop].value;
}
} //else nosessions=2

window.location=newlocation

//notebook.submit();

}


function remove(line) {


csession=window.notebook.session.value;

previtems=parseInt(csession)-2;
csession=parseInt(csession)-1;
window.notebook.session.value=csession;

if (previtems==line) {
updateLocate(csession);

} else {
//alert (previtems);
changeq=window.notebook.transqty[previtems].value;
changep=window.notebook.transpid[previtems].value;

window.notebook.transqty[line].value=changeq;
window.notebook.transpid[line].value=changep;

updateLocate(csession);
} // end if
}



function finalise() {
nocategory="finalise";

checkme=window.orderform.session.value;

if (checkme==1) {
window.orderform.submit();
 }
else
 {
nosessions=window.notebook.session.value;
window.notebook.category.value="finalise";

window.notebook.session.value=parseInt(nosessions)+1;
oneupsession=parseInt(nosessions);
nosessions=parseInt(nosessions)-2;
//alert(nosessions+"here");
newlocation='hardware.php?session='+oneupsession+'&category='+nocategory;
if (nosessions==0) { newlocation=newlocation+"&transpid[0]="+notebook.transpid[0].value+"&transqty[0]="+notebook.transqty[0].value;
	}else{
for (var loop=0; loop<=nosessions; loop++) {
newlocation=newlocation+"&transpid["+loop+"]="+notebook.transpid[loop].value+"&transqty["+loop+"]="+notebook.transqty[loop].value;
	}
 }
window.location=newlocation;
}
}


function checkHard(woow) {

var ipaddress=window.details.ipinfo.value;

    if (window.details.address.value.length < 10){
	alert("We need a delivery address. (Proxy IP "+ipaddress+" recorded.)");
       	window.details.address.focus();
       	window.details.address.select();
	return false;
	} 

	nobox=window.details.address.value.toLowerCase();

    if (nobox.indexOf("box ") != -1) {
	alert("Unfortunately we are unable to deliver to PO Boxes. (Proxy IP "+ipaddress+" recorded.)");
       	window.details.address.focus();
       	window.details.address.select();
	return false;
	} 
	
    if (window.details.fname.value.length ==""){
        alert("Please enter your first name. (Proxy IP "+ipaddress+" recorded.)");
       	window.details.fname.focus();
       	window.details.fname.select();
	return false;
    }

    if (window.details.phone.value.length < 6){
        alert("You must enter your daytime contact number. (Proxy IP "+ipaddress+" recorded.)");
       	window.details.phone.focus();
       	window.details.phone.select();
	return false;
    }

return true;
}



function checkArea1(trans){

var info=trans.value;

    if (info.length > 200){
        alert("Please reduce the size of your comments. They are too long to be processed.");
       	trans.focus();
       	trans.select();
    }
 //   return true;
}



function addFavourite(atag) {

agnt=navigator.userAgent.toLowerCase();

if (agnt.indexOf("msie") != -1) {

if (atag=="WebDev") {
atag="SiteSource - Web Sites that Work";
window.external.AddFavorite('http://www.sitesource.com.au',atag);
} else {
locators=document.URL;
atag="SiteSource - "+atag;
window.external.AddFavorite(locators,atag);
}

 } else {

if (atag=="DraftOrder") {
alert ("Simply bookmark this page to store your order, and return when you like. Prices will update automatically if changed.");
} else {
alert ("Auto storage is not supported by your browser. After we return you, please simply bookmark it.");
window.location='http://www.sitesource.com.au';
}

 }

} 



