/*
CSS Browser Selector v0.3.4 (Sep 29, 2009)
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
function css_browser_selector(u){var ua = u.toLowerCase(),is=function(t){return ua.indexOf(t)>-1;},g='gecko',w='webkit',s='safari',o='opera',h=document.getElementsByTagName('html')[0],b=[(!(/opera|webtv/i.test(ua))&&/msie\s(\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?g+' ff2':is('firefox/3.5')?g+' ff3 ff3_5':is('firefox/3')?g+' ff3':is('gecko/')?g:is('opera')?o+(/version\/(\d+)/.test(ua)?' '+o+RegExp.$1:(/opera(\s|\/)(\d+)/.test(ua)?' '+o+RegExp.$2:'')):is('konqueror')?'konqueror':is('chrome')?w+' chrome':is('iron')?w+' iron':is('applewebkit/')?w+' '+s+(/version\/(\d+)/.test(ua)?' '+s+RegExp.$1:''):is('mozilla/')?g:'',is('j2me')?'mobile':is('iphone')?'iphone':is('ipod')?'ipod':is('mac')?'mac':is('darwin')?'mac':is('webtv')?'webtv':is('win')?'win':is('freebsd')?'freebsd':(is('x11')||is('linux'))?'linux':'','js']; c = b.join(' '); h.className += ' '+c; return c;}; css_browser_selector(navigator.userAgent);
/**/


// form login

function clear_textbox(fieldVar)
{
	if (fieldVar == "_Usr") {
		if (document.frmLogin._Usr.value == "Username")
			document.frmLogin._Usr.value = "";
}
}


function add_textbox()
{
if (document.frmLogin._Usr.value == "")
document.frmLogin._Usr.value = "Username";
}
function clear_textbox2()
{
if (document.frmLogin._Pass.value == "Password")
	document.frmLogin._Pass.value = "";
}
function add_textbox2()
{
if (document.frmLogin._Pass.value == "")
document.frmLogin._Pass.value = "Password";
}

function loginForm() { 
	if (frmLogin._Usr.value == "Username" || frmLogin._Usr.value == "" || frmLogin._Pass.value == ""){
		alert("Please enter both Username and Password to login");
		return false;
	}  
}
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){
		   alert("Invalid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid  E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail Address")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.frmReminder._EmailR
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter an Email Address!")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }
function largeProd(strCode){
	var h,w
	switch(strCode){
	case "1":	h="186";w="500";break;
	case "2":	h="389";w="499";break;
	case "3":	h="184";w="400";break;
	case "4":	h="375";w="260";break;
	case "5":	h="132";w="490";break;
	case "6":	h="102";w="314";break;
	case "7":	h="410";w="274";break;
	case "8":	h="505";w="500";break;
	case "9":	h="192";w="311";break;
	}
	window.open("range" + strCode + ".html","bigProd","scrollbars=no,width=" + w + ",height="+ h);
}

function viewCols(strP){
	var oWin
	oWin = window.open("view-downloads.asp?Bead=" + strP,"cols","resizable=yes,scrollbars=yes,width=500,height=250,left=50,top=50")
	oWin.focus();
}
// ie fix

var isActive = false;

function hideFrm(){
  isActive = true;
  document.getElementById("colour").style.visibility="hidden";
  document.getElementById("unit").style.visibility="hidden";
  document.getElementById("pkNo").style.visibility="hidden";
}

function showFrm(){
  isActive = false;
  setTimeout('showElements()',100);
}

function showElements(){
  if(!isActive){
    document.getElementById("colour").style.visibility="visible";
	document.getElementById("unit").style.visibility="visible";
	document.getElementById("pkNo").style.visibility="visible";
  }
}
// form data transfer
function transferOver(){
	document.frmDelivery.delivery_firstname.value = document.frmCust.firstname.value;
	document.frmDelivery.delivery_surname.value = document.frmCust.surname.value;
	document.frmDelivery.delivery_address1.value = document.frmCust.address1.value;
	document.frmDelivery.delivery_address2.value = document.frmCust.address2.value;
	document.frmDelivery.delivery_town.value = document.frmCust.town.value;
	document.frmDelivery.delivery_county.value = document.frmCust.county.value;
	document.frmDelivery.delivery_postcode.value = document.frmCust.postcode.value;
	document.frmDelivery.delivery_country.value = document.frmCust.country.value;
	document.frmDelivery.delivery_telno.value = document.frmCust.telno.value;
	document.frmDelivery.delivery_email.value = document.frmCust.email.value;
}
// delete record choice

function delRecord(redirect,msg) {
			var answer = confirm(msg)
			if (answer){
			window.location.href=redirect;
			}
		else{
		alert("Record Deletion has been cancelled!")
	}
}

// jump menu

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
