function oldbrowser()
{
	if(document.getElementById){
	}
	else{
	document.location.href="http://framework.franke.firm/oldbrowser/index.html";
	}
}




function Changegrfx(id,src)
{
document.getElementById(id).src = src;
}


function ShowHideDiv(id,style)
{
document.getElementById(id).style.visibility = style;

}


function PopUpWindow(url,windowname,breite,hoehe,scroll,rez,tool,menu,loc,horz,vert)
{
// PopUpWindowGenerator

// url= zu öffnende url
// windowname = name des fensters
// breite = Breite des Fensters
// hoehe = Hoehe des Fensters
// scroll = Scrollbar (yes or no)
// rez = rezisable (yes or no)
// tool = Toolbar (yes or no)
// menu = Menubar (yes or no)
// horz = horizontale Ausrichtung (center or left or right)
// vert = vertikale Ausrichtung (top or middle or bottom)

var url;
var windowname;
var breite;
var hoehe;
var scroll;
var rez;
var tool;
var menu;
var loc;
var winl;
var wint;
var horz;
var vert;


// Berechnen von wint
if(vert=='top')
{
wint = 0;
}

if(vert=='middle')
{
wint = (screen.height - hoehe) / 2;
}

if(vert=='bottom')
{
wint = (screen.height - hoehe);
}
// Ende Berechnen von wint

		// Funktionsaufruf mit horz
		if(horz=='center')
		{
		winl = (screen.width - breite) / 2;
		popupwindow = 
		window.open(url,windowname, 'width='+breite+',height='+hoehe+',screenX='+winl+',screenY='+wint+',left='+winl+',top='+wint+',scrollbars='+scroll+',resizable='+rez+',toolbar='+tool+',menubar='+menu+',location='+loc);
		popupwindow.focus();
		}
		else
		{
			if(horz=='left')
			{
			winl = 0;
			popupwindow = 
			window.open(url,windowname, 'width='+breite+',height='+hoehe+',screenX='+winl+',screenY='+wint+',left='+winl+',top='+wint+',scrollbars='+scroll+',resizable='+rez+',toolbar='+tool+',menubar='+menu+',location='+loc);
			popupwindow.focus();
			
			}
			
			if(horz=='right')
			{
			winl = (screen.width - breite);
			popupwindow = 
			window.open(url,windowname, 'width='+breite+',height='+hoehe+',screenX='+winl+',screenY='+wint+',left='+winl+',top='+wint+',scrollbars='+scroll+',resizable='+rez+',toolbar='+tool+',menubar='+menu+',location='+loc);
			popupwindow.focus();
			
			}
		
		
		}
		// Ende Funktionsaufruf mit horz

// Funnktion schliessen
}



function clpSet(txt)
{
sel = document.selection.createRange();
window.clipboardData.setData("Text",txt);
}


function confirm_delete(x,y,url){
	var x;
	var y;
	var url;
	
	
	input_box=confirm("Are you sure you d'like to delete record  "+x+" ?");
		if (input_box==true)

		{ 
		// redirect when OK
		window.location = url; 
		}

		else
		{

		}

}


function MM_validateForm() { //v3.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (val!=''+num) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}

function MM_findObj(n, d) { //v3.0
  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); return x;
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


// ------------------------------ Additional Scripts Seisan 2003 ------------------------

function trim(str) { return( (""+str).replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') ); }


//CD March 27,2009
function orderProduct(prodid, src, node, parent, lvl)
{

	var thisform = document.getElementById('orderform');
	var qty = '0';
	var ret_val = true;
	
	if ( thisform.qty.value == null || thisform.qty.value == "" )
	{
		ret_val = false;
		alert("You must fill in a quantity");
	}
	else
	{
		if (isNaN(thisform.qty.value))
		{
			ret_val = false;
			alert("You must fill in a valid quantity");
		}
		else
		{
			if (parseInt(thisform.qty.value) <= 0)
			{
				ret_val = false;
				alert("You must fill in valid quantity");
			}
		}
	
	}
	
	if (ret_val)
	{
		qty = thisform.qty.value;
		//alert("qty:" + qty);
		
		var openURL = 'http://www.frankeksd.com/shoppingcart.php?prodid=' + prodid + '&node=' + node + '&group=' + parent + '&lvl=' + lvl + '&source=' + src + '&qty=' + qty;
		
		//alert(openURL);
		
		openWindow(openURL, 'KindredShoppingCart', '680','650');

	}
}


function checkOrderQty(thisform)
{

	var ret_val = true;
	
	if ( thisform.qty.value == null || thisform.qty.value == "" )
	{
		ret_val = false;
		alert("You must fill in a quantity");
	}
	else
	{
		if (isNaN(thisform.qty.value))
		{
			ret_val = false;
			alert("You must fill in a valid quantity");
		}
		else
		{
			if (parseInt(thisform.qty.value) <= 0)
			{
				ret_val = false;
				alert("You must fill in valid quantity");
			}
		}
	
	}

	return ret_val;
}


function checkQtyField(thisfield)
{
	

	if (thisfield.value == "" || thisfield.value == null)
	{
		
		alert("You cannot remove an item by changing the quantity, to remove this item click on the remove button");
		thisfield.focus();
		thisfield.select();
	}
	else
	{
		if (isNaN(thisfield.value))
		{
			
			alert("You must fill in a valid quantity");
			thisfield.focus();
			thisfield.select();
		}
		else
		{
			if (parseInt(thisfield.value) <= 0)
			{
				
				alert("You must fill in valid quantity");
				thisfield.focus();
				thisfield.select();
			}
		}
	
	}


}


function launchSelected(thisfield, pathStr)
{

	
	window.location = pathStr + thisfield[thisfield.selectedIndex].value;

}


function isValidEmail(str) {

   return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 
}


//----------------------- FORM VALIDATION FUNCTIONS ---------------------
function formvalidationContact(thisform)
{

 var ret_val = true;
 var errmsg = "";


if ( (thisform.firstname.value == null) || (thisform.firstname.value == "") )
	ret_val = false;

if ( (thisform.lastname.value == null) || (thisform.lastname.value == "") )
	ret_val = false;
	
if ( (thisform.address1.value == null) || (thisform.address1.value == "") )
	ret_val = false;
	
if ( (thisform.city.value == null) || (thisform.city.value == "") )
	ret_val = false;

if ( (thisform.zip.value == null) || (thisform.zip.value == "") || (isNaN(thisform.zip.value)) || thisform.zip.value.length < 5 )
{
	ret_val = false;
	errmsg += " - zipcode is not valid";
}
//if ( (thisform.states.value == null) || (thisform.states.value == "Choose a state") )
//alert('states option:[' + thisform.states.options[thisform.states.selectedIndex].text + ']');
if (thisform.states.options[thisform.states.selectedIndex].text == "Choose a state")
{
	ret_val = false;
	errmsg += " - a state must be chosen from the dropdown";
}

if ( (thisform.email.value == null) || (thisform.email.value == "") || !isValidEmail(thisform.email.value) )
{
	ret_val = false;
	errmsg += " - email is not valid";
}

if (ret_val == false)
	alert("Please fill in all require fields indicated by * " + errmsg);


 return ret_val;
 
}

function formvalidationContactCanada(thisform, useFrench)
{

 var ret_val = true;
 var errmsg = "";
 
 if (useFrench)
	errmsg = "Please fill in all require fields indicated by * (FR) ";
 else
	errmsg = "Please fill in all require fields indicated by * ";


if ( (thisform.firstname.value == null) || (thisform.firstname.value == "") )
	ret_val = false;

if ( (thisform.lastname.value == null) || (thisform.lastname.value == "") )
	ret_val = false;
	
if ( (thisform.address1.value == null) || (thisform.address1.value == "") )
	ret_val = false;
	
if ( (thisform.city.value == null) || (thisform.city.value == "") )
	ret_val = false;

if ( (thisform.zip.value == null) || thisform.zip.value.length != 6 )
{
	ret_val = false;
	
	if (useFrench)
		errmsg += " - postal code is not valid (FR)";
	else
		errmsg += " - postal code is not valid";
}
	
//if ( (thisform.states.value == null) || (thisform.states.value == "Choose a state") )
//alert('states option:[' + thisform.states.options[thisform.states.selectedIndex].text + ']');
if (thisform.province.options[thisform.province.selectedIndex].value == "0")
{
	ret_val = false;
	
	if (useFrench)
		errmsg += " - a province must be chosen from the dropdown (FR)";
	else
		errmsg += " - a province must be chosen from the dropdown";
}

if ( (thisform.email.value == null) || (thisform.email.value == "") || !isValidEmail(thisform.email.value) )
{
	ret_val = false;
	
	if (useFrench)
		errmsg += " - email is not valid (FR)";
	else
		errmsg += " - email is not valid";
}

if (ret_val == false)
	alert(errmsg);


 return ret_val;
 
}


function formvalidationFilterReg(thisform)
{

 var ret_val = true;


if ( (thisform.firstname.value == null) || (thisform.firstname.value == "") )
	ret_val = false;

if ( (thisform.lastname.value == null) || (thisform.lastname.value == "") )
	ret_val = false;
	
if ( (thisform.address1.value == null) || (thisform.address1.value == "") )
	ret_val = false;
	
if ( (thisform.city.value == null) || (thisform.city.value == "") )
	ret_val = false;

if ( (thisform.zip.value == null) || (thisform.zip.value == "") )
	ret_val = false;

if ( (thisform.states.value == null) || (thisform.states.value == "Choose a state") )
	ret_val = false;
	
if ( (thisform.phone.value == null) || (thisform.phone.value == "") )
	ret_val = false;

if ( (thisform.model.value == null) || (thisform.model.value == "") )
	ret_val = false;

if ( (thisform.serial.value == null) || (thisform.serial.value == "") )
	ret_val = false;


if (ret_val == false)
	alert("Please fill in all require fields indicated by *");


 return ret_val;
}

function formvalidationCheckOut(thisform)
{
//alert("here: " + thisform.CustomerID.value);

 var ret_val = true;
 var msg = "";

 var address = trim(thisform.address1.value);

if ( (trim(thisform.firstname.value) == null) || (trim(thisform.firstname.value) == "") )
	ret_val = false;

if ( (trim(thisform.lastname.value) == null) || (trim(thisform.lastname.value) == "") )
	ret_val = false;
	
if ( (trim(thisform.address1.value) == null) || (trim(thisform.address1.value) == "") )
	ret_val = false;
	
//Check for PO Box Entry
if ( address.substring(0,2) == "PO")
	ret_val = false;

if ( address.substring(0,4) == "P.O.")
	ret_val = false;
		
if ( address.substring(0,3) == "P O")
	ret_val = false;
	
if ( (trim(thisform.city.value) == null) || (trim(thisform.city.value) == "") )
	ret_val = false;

if ( (trim(thisform.zip.value) == null) || (trim(thisform.zip.value) == "") )
	ret_val = false;

if ( (thisform.states.value == null) || (thisform.states.value == "Choose a state") )
	ret_val = false;

if ( (trim(thisform.phone.value) == null) || (trim(thisform.phone.value) == "") )
	ret_val = false;

if ( (trim(thisform.email.value) == null) || (trim(thisform.email.value) == "") )
	ret_val = false;

if ( (trim(thisform.cardno.value) == null) || (trim(thisform.cardno.value) == "") )
	ret_val = false;
	
if ( (thisform.month.value == null) || (thisform.month.value == "") )
	ret_val = false;
	
if ( (thisform.year.value == null) || (thisform.year.value == "") )
	ret_val = false;
	
	
	
if ( (trim(thisform.shipfirstname.value) == null) || (trim(thisform.shipfirstname.value) == "") )
	ret_val = false;

if ( (trim(thisform.shiplastname.value) == null) || (trim(thisform.shiplastname.value) == "") )
	ret_val = false;
	
if ( (trim(thisform.shipaddress1.value) == null) || (trim(thisform.shipaddress1.value) == "") )
	ret_val = false;
	
if ( (trim(thisform.shipcity.value) == null) || (trim(thisform.shipcity.value) == "") )
	ret_val = false;

if ( (trim(thisform.shipzip.value) == null) || (trim(thisform.shipzip.value) == "") )
	ret_val = false;

if ( (thisform.shipstates.value == null) || (thisform.shipstates.value == "Choose a state") )
	ret_val = false;

if (ret_val == false)
	msg = "Please fill in all require fields indicated by * and make sure your address is not a P.O. Box, no orders can be placed to a P.O. Box";


if((trim(thisform.shipfirstname.value).indexOf(",") >= 0) || (trim(thisform.shiplastname.value).indexOf(",") >= 0)){
	if(msg == "")
		msg = "First Name and Last Name can not contain a comma.";
	else
		msg += "\nFirst Name and Last Name can not contain a comma.";
}


if(thisform.hdCustomerID.value == ""){
	if (thisform.ddQuestion.value == 0){
		ret_val = false;
	}	

	if ( (trim(thisform.answer.value) == null) || (trim(thisform.answer.value) == "") ){
		ret_val = false;
	}	
	
	if ( (trim(thisform.password.value) == null) || (trim(thisform.password.value) == "") ){
		ret_val = false;
	}	
	
	if(ret_val == false && msg == "")
			msg = "Please fill in all require fields indicated by *";
			
	if (thisform.password.value.length < 7){
		ret_val = false;
		msg += "\nPassword must be at least 7 characters";
	}
	
	if(thisform.password.value != thisform.confirmpassword.value){
		msg += "\nPassword must match confirm password.";
		ret_val = false;
	}
}
else if(thisform.password.value.length > 0){

	if (thisform.password.value.length < 7){
		ret_val = false;
		msg += "\nPassword must be at least 7 characters";
	}
	
	if(thisform.password.value != thisform.confirmpassword.value){
		msg += "\nPassword must match confirm password.";
		ret_val = false;
	}
}

if (ret_val == false)
	alert(msg);

 return ret_val; 
}

function PopulateBillingInfo(){

	if(document.form1.cbBilling.checked){
		document.form1.firstname.value = document.form1.shipfirstname.value;
		document.form1.lastname.value = document.form1.shiplastname.value;
		document.form1.address1.value = document.form1.shipaddress1.value;
		document.form1.address2.value = document.form1.shipaddress2.value;
		document.form1.city.value = document.form1.shipcity.value;
		document.form1.states.value = document.form1.shipstates.value;
		document.form1.zip.value = document.form1.shipzip.value;
	}
	else{
		document.form1.firstname.value = "";
		document.form1.lastname.value = "";
		document.form1.address1.value = "";
		document.form1.address2.value = "";
		document.form1.city.value = "";
		document.form1.states.value = "Choose a state";
		document.form1.zip.value = "";
	}
}

function trim(st) {
	var len = st.length
	var begin = 0, end = len - 1;
	while (st.charAt(begin) == " " && begin < len) {
		begin++;
	}
	while (st.charAt(end) == " " && begin < end) {
		end--;
	}
	return st.substring(begin, end+1);
}