var whitespace = " \t\n\r";

function contactWebmaster(){

        msg = "This e-mail address is meant for webtechnical issues only.\n";
        msg = msg + "To get information about Franke and its products please use ";
        msg = msg + "the Contact \n button located in the red bar at the top of each page.\n\n";
        msg = msg + "Do you still want to send an e-mail to the webmaster?"

        if (confirm(msg))
                parent.location.href="/contact/index.php?EMAILADDRESS=webmaster@franke.com"

}

function oldbrowser()
{
	if(document.getElementById){
	}
	else{
	document.location.href="";
	}
}




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

}


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



}


function Fokusierung()
{
self.focus();
}


	function modDate(doc){

        var dateStr = doc.lastModified;
        var parseDate = Date.parse(dateStr);

        if (parseDate != 0){
                return dateStr;
        }
        else{
                return "Dynamic Content";
        }

}





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 confirmation_box(message,trueurl)
{
var message;
var trueurl;
	
	input_box = confirm(""+message+"")
	if(input_box==true)
	{
	window.location = trueurl; 
	}
	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;
}




function checkspbadditem(spbadditem)
{
var msg = "Please check the following data:\n\n";
var valid = true;
var comp = spbadditem.item_company.selectedIndex;
var cat  = spbadditem.item_category.selectedIndex;
var i = 1;


if (isWhitespace(spbadditem.item_headline.value)){
 	msg = msg + "Headline\n";
 	valid = false;
}
	
if (isWhitespace(spbadditem.item_desc.value)){
 	msg = msg + "Description\n";
 	valid = false;
}





if (((isWhitespace(spbadditem.item_unit_1.value) || isWhitespace(spbadditem.item_price_1.value) || isWhitespace(spbadditem.item_currency_1.value)) && !((isWhitespace(spbadditem.item_unit_1.value) && isWhitespace(spbadditem.item_price_1.value) && isWhitespace(spbadditem.item_currency_1.value)) || (!isWhitespace(spbadditem.item_unit_1.value) && !isWhitespace(spbadditem.item_price_1.value) && !isWhitespace(spbadditem.item_currency_1.value))))) {
	msg = msg + "Pricing 1\n";
	valid = false;
	}

	
	if (((isWhitespace(spbadditem.item_unit_2.value) || isWhitespace(spbadditem.item_price_2.value) || isWhitespace(spbadditem.item_currency_2.value)) && !((isWhitespace(spbadditem.item_unit_2.value) && isWhitespace(spbadditem.item_price_2.value) && isWhitespace(spbadditem.item_currency_2.value)) || (!isWhitespace(spbadditem.item_unit_2.value) && !isWhitespace(spbadditem.item_price_2.value) && !isWhitespace(spbadditem.item_currency_2.value))))) {
	msg = msg + "Pricing 2\n";
	valid = false;
	}
	
	
	if (((isWhitespace(spbadditem.item_unit_3.value) || isWhitespace(spbadditem.item_price_3.value) || isWhitespace(spbadditem.item_currency_3.value)) && !((isWhitespace(spbadditem.item_unit_3.value) && isWhitespace(spbadditem.item_price_3.value) && isWhitespace(spbadditem.item_currency_3.value)) || (!isWhitespace(spbadditem.item_unit_3.value) && !isWhitespace(spbadditem.item_price_3.value) && !isWhitespace(spbadditem.item_currency_3.value))))) {
	msg = msg + "Pricing 3\n";
	valid = false;
	}
	
	
	if (((isWhitespace(spbadditem.item_unit_4.value) || isWhitespace(spbadditem.item_price_4.value) || isWhitespace(spbadditem.item_currency_4.value)) && !((isWhitespace(spbadditem.item_unit_4.value) && isWhitespace(spbadditem.item_price_4.value) && isWhitespace(spbadditem.item_currency_4.value)) || (!isWhitespace(spbadditem.item_unit_4.value) && !isWhitespace(spbadditem.item_price_4.value) && !isWhitespace(spbadditem.item_currency_4.value))))) {
	msg = msg + "Pricing 4\n";
	valid = false;
	}




if (!valid){
	alert(msg);
	} return valid;




}



function isWhitespace(s){

        var i;

    if (isEmpty(s)) return true;

    for (i = 0; i < s.length; i++){
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) return false;
    }

    return true;
}


function isEmpty(s){
   return ((s == null) || (s.length == 0))
}



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