// PreLoad (Begin)
// ----------------------------------------------------------------------

var IMAGE_WINDOW;

// ----------------------------------------------------------------------
// PreLoad (End)



function start_Timeout(){
	if (timer) window.clearTimeout(timer);
	timer = window.setTimeout("resetAll()",50);
}

function clear_Timeout(){
	if (timer) window.clearTimeout(timer);
}

function resetAll(){
	if (obj = document.getElementById('servNavService')) 				obj.className = 'hideLayer';
	if (obj = document.getElementById('servNavPlusService'))	 	obj.className = 'servNavPlus';
	if (obj = document.getElementById('servNavServiceWrap'))	 	obj.className = 'servNavLinksWrap';
	if (obj = document.getElementById('servNavLanguages')) 			obj.className = 'hideLayer';
	if (obj = document.getElementById('servNavLangSelectLink')) obj.className = 'servNavPlus';
	if (obj = document.getElementById('servNavLangSelectWrap')) obj.className = 'servNavLinksWrap';
	if (obj = document.getElementById('servNavLinks')) 					obj.className = 'hideLayer';
	if (obj = document.getElementById('servNavLinkSelectLink')) obj.className = 'servNavPlus';
	if (obj = document.getElementById('servNavLinkSelectWrap')) obj.className = 'servNavLinksWrap';
}

function showLayer(idLayer,idTrigger,wrapper){
	if (obj = document.getElementById(idLayer)) obj.className = 'showLayer';
	if (obj = document.getElementById(idTrigger)) obj.className = 'servNavPlusHover';
	if (obj = document.getElementById('servNav'+wrapper+'Wrap')) obj.className = 'servNav'+wrapper+'WrapHover';
}
function hideLayer(idLayer,idTrigger){
	if (timer) window.clearTimeout(timer);
	layerObj = idLayer;
	triggerObj = idTrigger;
	timer = window.setTimeout("resetAll()", 50);
}

function doLoad() {
	//loaded = true;
	resetAll();// dropdowns made visible via javascript - without js they are visible all the time
	if (obj = document.getElementById("servNavService")) obj.onmouseout = start_Timeout;
	if (obj = document.getElementById("servNavService")) obj.onmousemove = clear_Timeout;
	if (obj = document.getElementById("servNavPlusService")) obj.onmouseover = changeService;
	if (obj = document.getElementById("servNavPlusService")) obj.onfocus = changeService;
	if (obj = document.getElementById("servNavPlusService")) obj.onmouseout = start_Timeout;
	if (obj = document.getElementById("servNavPlusService")) obj.onmousemove = clear_Timeout;
	
	if (obj = document.getElementById("servNavLanguages")) obj.onmouseout = start_Timeout;
	if (obj = document.getElementById("servNavLanguages")) obj.onmousemove = clear_Timeout
	if (obj = document.getElementById("servNavLangSelectLink")) obj.onmouseover = changeLangSelect;
	if (obj = document.getElementById("servNavLangSelectLink")) obj.onfocus = changeLangSelect;
	if (obj = document.getElementById("servNavLangSelectLink")) obj.onmouseout = start_Timeout;
	if (obj = document.getElementById("servNavLangSelectLink")) obj.onmousemove = clear_Timeout;

	if (obj = document.getElementById("servNavLinks")) obj.onmouseout = start_Timeout;
	if (obj = document.getElementById("servNavLinks")) obj.onmousemove = clear_Timeout
	if (obj = document.getElementById("servNavLinkSelectLink")) obj.onmouseover = changeLinks;
	if (obj = document.getElementById("servNavLinkSelectLink")) obj.onfocus = changeLinks;
	if (obj = document.getElementById("servNavLinkSelectLink")) obj.onmouseout = start_Timeout;
	if (obj = document.getElementById("servNavLinkSelectLink")) obj.onmousemove = clear_Timeout;	
	
}


function changeService(){
	showLayer('servNavService','servNavPlusService','Service')
}
function changeLangSelect(){
	showLayer('servNavLanguages','servNavLangSelectLink','LangSelect')
}
function changeLinks(){
	showLayer('servNavLinks','servNavLinkSelectLink','LinkSelect')
}

function previewOn() {
    location.search = (location.search)?location.search+'&preview':'?preview';
}

function previewOff() {
    var locSrc = location.search;
    locSrc = locSrc.replace(/\&preview/, "");
    locSrc = locSrc.replace(/\?preview/, "?");
    if (locSrc=="?") locSrc = "";
    location.search = locSrc;
}

var timer = 1;

function jump() {
	var selectedIndex = document.laender.land.selectedIndex;
	if (selectedIndex > 0) {
		var selection = document.laender.land.options[selectedIndex].value;
		window.open(selection);
	}
}

function doJump(obj, newWindow)
{
	var selectedIndex = obj.selectedIndex;
	var cUrl = obj.options[selectedIndex].value;
	
	if( cUrl != "" )
	{
		if( newWindow )
		{
			window.open(cUrl);
		}
		else
		{
			document.location.href = cUrl;
		}
	}
}

	function oWinCB(url,title,sizeH,sizeV) {
	    winHandle = top.open(url,title,'toolbar=no,directories=no,status=no,scrollbars=yes,menubar=no,resizable=yes,width='+sizeH+',height='+sizeV);
	    if(navigator.appVersion.indexOf("MSIE 3",0)==-1) {
	        id = setTimeout('winHandle.focus()',1000);
	    }
	}


// Image PopUp (Begin)
// ----------------------------------------------------------------------

function openImageWindow(URL,Language) {

  var IMAGE_ID = URL.substring(0,7);

  if (navigator.appName == "Netscape" && parseInt(navigator.appVersion.charAt(0)) < 5) {
    var Properties = "width=200,height=100,left=0,top=0,scrollbars=yes,menubar=no,toolbar=no,location=no,status=no,resizable=yes";

    switch(Language) {
      case "l1":
        IMAGE_WINDOW = window.open("/mcc/picturelibrary/WindowTools-Image_Loading-d.html?"+URL,"IMAGE_ID",Properties);
      break;
      default:
        IMAGE_WINDOW = window.open("/mcc/picturelibrary/1008078/WindowTools-Image_Loading-e.html?"+URL,"IMAGE_ID",Properties);
      break;
    }
  }
  else {
    var Properties = "width=200,height=100,left=0,top=0,scrollbars=yes,menubar=no,toolbar=no,location=no,status=no,resizable=no";

    switch(Language) {
      case "l1":
        IMAGE_WINDOW = window.open("/mcc/picturelibrary/WindowTools-Image_Vorlage-CSS-d.html?"+URL,"IMAGE_ID",Properties);
      break;
      default:
        IMAGE_WINDOW = window.open("/mcc/picturelibrary/WindowTools-Image_Vorlage-CSS-e.html?"+URL,"IMAGE_ID",Properties);
      break;
    }
  }
  IMAGE_WINDOW.focus();
}

// ----------------------------------------------------------------------
// Image PopUp (Ende)

window.onload = doLoad;
//   ask mak a question box 
function openVA(){
	var now = new Date();
	URL = 'http://help3.creativevirtual.com/makro/bot.htm'
	uid = now.getTime() + Math.floor(Math.random()*100);
	URL += '?uid='+uid+'&entry='+document.formAsk.entry.value;		//this parameter is required	
	window.open(URL+'&SiteContext=SITE1&StartContext= FAQs.Products ','VA','width=470,height=528');
}

function addProductRow(){
	var table = document.getElementById('products');
	var lastRow = table.rows[table.rows.length - 1];
	var newRow = lastRow.cloneNode(true);
	var tr = table.insertRow(table.rows.length);
	var newNumber = 0;
	
	for(i = 0; i < newRow.childNodes.length; i++){
		var clonedTD = newRow.childNodes[i].cloneNode(true);
		if(i == 0){//if it is the first column
			newNumber = Number(clonedTD.childNodes[0].value) + 1;
			clonedTD.childNodes[0].value = newNumber; //increase the value of the column by 1
		}
		clonedTD.childNodes[0].name = "order" + newNumber;
		tr.appendChild(clonedTD);
	}
}