function openNavItem(tabid)
{
    document.location.href = "http://"+window.location.host+"/desktopdefault.aspx/tabid-"+tabid;
}

function hrefReplace(ddl, errorMsg)
{
    if(ddl && ddl.options[ddl.selectedIndex].value.length>0)
    {
        val = ddl.options[ddl.selectedIndex].value;
        url = (val.indexOf("/")==0 || val.indexOf("http")==0 ) ? val : '/'+val;
        window.location.href = url;
    }
    else
    {
        if(errorMsg)
            alert(errorMsg)
    }
}

function gotoPage(ddlId, errorMsg)
{
    ddl = document.getElementById(ddlId);
    hrefReplace(ddl, errorMsg);
}

function gotoPressFinder(ddlId, tabId, modId)
{
    ddl = document.getElementById(ddlId);
    if(ddl && ddl.options[ddl.selectedIndex].value.length>0)
        hrefReplace(ddl);//window.location.href='/desktopdefault.aspx/tabid-'+tabid+'/'+modId+'_view-'+ddl.options[ddl.selectedIndex].value;
    else
        window.location.href='/desktopdefault.aspx/tabid-'+tabid;
}

function initPage()
{
    //makeDropDown('dropDownLng');
    //makeDropDown('dropDown');
    //makeDropDown('dropDownProd');
    placeDropDownNav();
    prepareProducts()
}

function gotoCategoryFinder(ddlId, tabid, modId, errorMsg)
{
    ddl = document.getElementById(ddlId);
    if(ddl && ddl.options[ddl.selectedIndex].value.length>0)
    {
        window.location.href='/products/desktopdefault.aspx/tabid-'+tabid+'/'+modId+'_view-'+ddl.options[ddl.selectedIndex].value;
    }
    else
    {
        if(errorMsg)
            alert(errorMsg)
    }
}

function gotoBPCategoryFinder(ddlPrefix, count, tabId, errorMsg) 
{
    cat=''
    for(i=1; i<=count; i++)
    {
        ddl = document.getElementById(ddlPrefix+i);
        
        if(ddl && ddl.options[ddl.selectedIndex].value.length>0)
            cat += (cat.length>0) ? ","+ddl.options[ddl.selectedIndex].value : ddl.options[ddl.selectedIndex].value;
    }
    if(cat.length==0)
        alert(errorMsg);
    else
        window.location.href='/products/desktopdefault.aspx/tabid-'+tabId+'/categories-'+cat;
}

function gotoProductFinder(ddlId0, ddlId1, ddlId2, ddlId3, errorMsg, tabId)
{
	ddl0 = document.getElementById(ddlId0);
	ddl1 = document.getElementById(ddlId1);
	ddl2 = document.getElementById(ddlId2);
	ddl3 = document.getElementById(ddlId3);
	cat=''
	cat += getCat(cat, ddl0);
	cat += getCat(cat, ddl1);
	cat += getCat(cat, ddl2);
	cat += getCat(cat, ddl3);
	
	if(cat.length==0)
        alert(errorMsg);
    else
        window.location.href='/products/desktopdefault.aspx/tabid-'+tabId+'/categories-'+cat;
}

function getCat(cat, ddl)
{
	if(ddl && ddl.options[ddl.selectedIndex].value.length>0)
		return (cat.length>0) ? ","+ddl.options[ddl.selectedIndex].value : ddl.options[ddl.selectedIndex].value;	
	else
		return '';
}

function selectItem(ddlId)
{
    result = false;
    if( (index=document.location.href.indexOf("categories-")) > -1 )
    {
        str = document.location.href.substring(index+11, document.location.href.length)+(",");
        ddl = document.getElementById(ddlId);
        for(i=0; i<ddl.options.length; i++)
        {
            if( str.indexOf(ddl.options[i].value+",")>-1)
            {
                ddl.options[i].selected = true;
                result = true;
            }
        }
    }
    return result;
}

function selectItemFromDDL(ddl)
{
    if( (index=document.location.href.indexOf("categories-")) > -1 )
    {
        str = document.location.href.substring(index+11, document.location.href.length)+(",");
        for(i=0; i<ddl.options.length; i++)
        {
            if( str.indexOf(ddl.options[i].value+",")>-1)
                ddl.options[i].selected = true;
        }
    }
}

function openWin(wFile,wWidth,wHeight,wScrolling)
{
	myWin=window.open(wFile,'windowContentPicker','width='+wWidth+',height='+wHeight+',scrollbars='+wScrolling);
	myWin.moveTo((screen.width/2)-(wWidth/2),(screen.height/2)-(wHeight/2));
	myWin.focus();
}

/** DROP DOWN FUNCTIONS **/
var dropDowns = new Array();
function hideDropDowns()
{
	for(i=0; i<dropDowns.length;i++)
	{
		if(dropDowns[i] && document.getElementById(dropDowns[i]+"Items").style.display=="block")
		{
			dropDownShowHide(dropDowns[i])
		}
	}
}

document.onclick = hideDropDowns;
window.onresize = repositionDropDowns;

function makeDropDown(objContainerId)
{
	//div
	containerObj = document.getElementById(objContainerId);
	//ul
	obj = document.getElementById(objContainerId+'Items');
	objOverflow = document.getElementById(objContainerId+'Overflow');
	//div for text
	objText = document.getElementById(objContainerId+'Text');
	
	if(obj || objOverflow)
	{
		//set events
		containerObj.onclick = dropDownEvent;
	    obj.onclick = dropDownEvent;
		//add objectContainer to collection
		dropDowns[dropDowns.length] = objContainerId;
		//set positions
		if(objOverflow)
		{
			setUpPosition(containerObj, objOverflow, objText);
			obj.style.visibility = "visible"
		}
		else
			setPosition(containerObj, obj, objText);
	}
}

function repositionDropDowns()
{
    placeDropDownNav();
    
    for(i=0; i<dropDowns.length; i++)
    {
        //div
	    containerObj = document.getElementById(dropDowns[i]);
	    //ul
	    obj = document.getElementById(dropDowns[i]+'Items');
	    //div for text
	    objText = document.getElementById(dropDowns[i]+'Text');
	    //set postition
	    setPosition(containerObj, obj, objText);
    }
}

function setUpPosition(containerObj, obj, objText)
{
    //get container postion
	contPosition = findPos(containerObj);
	obj.style.visibility = "visible"
	
	//if dropdown items are widther than container
	parentWidth = (contPosition[1]-contPosition[3]);
	
	//set the width of the text div and minus paddings etc.
	objText.style.width = parentWidth-21;

	obj.style.left = contPosition[3]; // item postion is same as container left pos
	
	//position top is same as bottom position of the parent item
	obj.style.top = (contPosition[0]-394);
}

function setPosition(containerObj, obj, objText)
{
    //get container postion
	contPosition = findPos(containerObj);
	//get items width
	obj.style.display = "block";
	itemsWidth =  obj.offsetWidth;
	obj.style.display = "none";
	obj.style.visibility = "visible"
	
	//if dropdown items are widther than container
	parentWidth = (contPosition[1]-contPosition[3]);
	
	//set the width of the text div and minus paddings etc.
	objText.style.width = parentWidth-21;

	if(itemsWidth > parentWidth )
	{
		obj.style.left = (contPosition[1]-itemsWidth); //item postion is right coordinate - obj width
		obj.style.width = itemsWidth;
	}
	else
	{
		obj.style.width = parentWidth;
		obj.style.left = contPosition[3]; // item postion is same as container left pos
	}
	
	//position top is same as bottom position of the parent item
	obj.style.top = (contPosition[2]);
}

function findPos(obj) {
	var curleft = curtop = 0;
	var curwidth = curheigt = 0;
	
	curwidth = obj.offsetWidth;
	curheight = obj.offsetHeight;
	
	//alert(obj.offsetParent.offsetLeft)
	if (obj.offsetParent) 
	{
		curleft = obj.offsetLeft;
		curtop = obj.offsetTop;
		curwidth = obj.offsetWidth;
		curheight = obj.offsetHeight;
		while (obj = obj.offsetParent) 
		{
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
	}
	//top, right, bottom, left
	return [curtop, (curleft+curwidth), (curtop+curheight), curleft];
}

function changeStyle(obj)
{
	myHidden = document.getElementById(obj.parentNode.id.replace("Items", "Value"));
	ddlItem = document.getElementById("item_"+myHidden.value.toString());
	if(ddlItem)
		ddlItem.className="";
	
	if(obj && obj.className=="")
		obj.className = "active";
	else if (obj && obj.className=="active" && obj.id!="item_"+myHidden.value)
		obj.className = "";
}

function dropDownEvent(e)
{
	if (!e) var e = window.event;
	e.cancelBubble = true;
	if (e.stopPropagation) e.stopPropagation();
	
	if(e.target)
		target = e.currentTarget;//w3c model
	else
		target = e.srcElement;//windows model
		
	if(target.id && target.id.length==0 || (target.id && target.id=='firstItem') 
	        || target.id.indexOf("imgs_")!=-1)
	    target.id = target.parentNode.parentNode.id;
	
	//alert(target.id);
	    
	if(target.id && target.id.indexOf("item")==-1 && target.id.indexOf("Text")==-1 )
		dropDownShowHide(target.id);//if the dropdown called
	else
		dropDownShowHide(target.parentNode.id)//if the dropdownitem called
}

function dropDownShowHide(objId)
{
	itemsId = (objId.indexOf("Items")>0) ? itemsId : objId+"Items";
	parentId = objId.replace("Items", "");
	
	
	for(i=0; i<dropDowns.length;i++)
	{
	    obj = document.getElementById(dropDowns[i]+"Items");
	    objOverflow = document.getElementById(dropDowns[i]+"Overflow");
	    if(parentId==dropDowns[i])
	    {
	        //alert(document.getElementById(dropDowns[i]).innerHTML)
	        obj.style.display  = (obj.style.display=="block") ? "none" : "block";//hide or show
	        if(objOverflow)
				objOverflow.style.display  = (objOverflow.style.display=="block") ? "none" : "block";//hide or show
	        //alert( obj.id + " -> " +obj.style.display  );
	    }
	    else
	    {
	        obj.style.display  = "none"; //hide others
	        if(objOverflow)
				objOverflow.style.display  = "none"; 
	    }
	        
	}
	
	//set selected value as active
	myHidden = document.getElementById(itemsId.replace("Items", "Value"));
	ddlItem = document.getElementById("item_"+myHidden.value.toString());
	//alert("item_"+myHidden.value.toString())
	ddlItem.className = "active";
}

function setValue(obj)
{
    parentId = obj.parentNode.id.replace("Items", "")
	objContainer = document.getElementById(parentId+"Text");
	
	//change the id of the image
	if(obj.firstChild)
	{
	    try
	    {
	        obj.firstChild.id="imgs_1";
	    }
	    catch(e) {
	        //do nothing
	    }
	   
	 }
	
	objContainer.innerHTML = obj.innerHTML;
	
	//store value in hidden box	
	document.getElementById(parentId+"Value").value=obj.id.replace("item_", "");
	if(document.getElementById(parentId+"AutoPostBack").value=="True")
	    replaceLocation(parentId+"Value")
	    
}

function replaceLocation(objId)
{
	obj = document.getElementById(objId);
	if(obj)
	{
		if(obj.value.length>0)
		{
			vars = obj.value.split("-")
			if(vars.length==2)
			    document.location.href="/"+vars[0]+"/desktopdefault.aspx/tabid-"+vars[1];
			else if(vars.length>2)
			    document.location.href="/"+vars[0]+"/desktopdefault.aspx/tabid-"+vars[1]+"/"+vars[2]+"_read-"+vars[3];
		}
		else
			alert("please choose country & language");
	}
}

function placeDropDownNav()
{
	par = document.getElementById("ctl00_MainNavigationPanel");
	if(par)
	{
		elem = par.getElementsByTagName("ul");
		if(elem)
		{
			for(i=0; i<elem.length; i++)
			{
				if(elem[i].id.indexOf("ddNav")!=-1)
				{
					placeElement(elem[i], i);
				}
			}
		}
	}
}

function changeImageBack(obj, url)
{
	obj.childNodes[0].src = url;
}

function changeImage(obj, url)
{
	obj.childNodes[0].src = url;
}

/** DROP DOWN NAVIGATION **/
function placeElement(obj, index)
{
	//preloadNavImage(obj.parentNode.firstChild.firstChild);
	parentPosition = findPos(obj.parentNode);
	obj.style.top = parentPosition[0]+20;
	
	//place on left side if the id does not contain Right or if the index is smaller than 7
	//obj.id.indexOf("Right")==-1 || 
	if(index<8)
	{//place it on the left side
		obj.style.left = parentPosition[3]-1;
	}
	else
	{//place it on the right side
		obj.style.left = parentPosition[1]-183;
		
	}
}

function showDropDown(obj, isActive)
{
	if(!isActive)
		obj.className = "active";
	//show drop down
	dd = obj.getElementsByTagName("ul")[0];
	if(dd)
	    dd.style.display = "block";
	
}

function hideDropDown(obj, isActive)
{
	if(!isActive)
		obj.className = ""
	
	//hide dropdown
	dd = obj.getElementsByTagName("ul")[0];
	if(dd)
	    dd.style.display = "none";
}

/*function preloadNavImage(img)
{
	if(img)
	{
		imgActive = new Image();
		if(img.src.indexOf("_active")==-1)
			imgActive.src = getImageSrc(img)
		else
			imgActive.src = img.src.replace("_active", "");
	}
}*/

function getImageSrc(img)
{
	lastIndex = img.src.lastIndexOf("_");
	return img.src.substring( 0, lastIndex ) +"_active"+ img.src.substring( lastIndex, img.src.length )
}

function openLevel(obj)
{
    if(obj.className=="")
    {//open nodes
        obj.className="active";
        if(obj.parentNode.childNodes)
        {
            for(i=0; i<obj.parentNode.childNodes.length;i++)
            {
                if(obj.parentNode.childNodes[i].tagName=="DIV")
                    obj.parentNode.childNodes[i].style.display="block";
            }
        }
    }
    else
    {//close nodes
        obj.className="";
        if(obj.parentNode.childNodes)
        {
            for(i=0; i<obj.parentNode.childNodes.length;i++)
            {
                if(obj.parentNode.childNodes[i].tagName=="DIV")
                    obj.parentNode.childNodes[i].style.display="none";
            }
        }
    }
}

function openPane(parentObjId, objId, closeObjId)
{
	obj = document.getElementById(objId);
	closeObj = document.getElementById(closeObjId);
	closeObj.style.display = "none";
	if(obj.style.display=="block")
	{
		obj.style.display =  "none";
	}
	else
	{
		obj.style.display =  "block";
		posPane(parentObjId, objId)
	}
}

function posPane(parentObjId, objId)
{	
	oImg = document.getElementById(parentObjId)
	oDiv = document.getElementById(objId)

	imgPosition = findPos(oImg);
	divPosition = findPos(oDiv);
	
	//top, right, bottom, left
	oDiv.style.top = imgPosition[0]-(divPosition[2]-divPosition[0])+2
	oDiv.style.left = imgPosition[3];
}

function placeFlashFile()
{
	objFlash = document.getElementById("flashLayer");
	
	if(objFlash)
	{
		objFlashFile = document.getElementById("flashFileDiv");
		flashPosition = findPos(objFlash);
		
		objFlashFile.style.left = flashPosition[3]-200;
		objFlashFile.style.top = flashPosition[0];
	}
}

function OnResizeWindow()
{
	repositionDropDowns();
	placeFlashFile();
}

function promotionClose()
{
	YAHOO.example.container.imgPanel.hide();
}

var isPreload = false;
var imgArray = new Array();
var imgArrayActive = new Array();
//left image
imgArray[0] = new Image();
imgArray[0].src = "portaldata/1/images/navigation/product_left.gif";
//middle image
imgArray[1] = new Image();
imgArray[1].src = "portaldata/1/images/navigation/product.gif";
//right
imgArray[2] = new Image();
imgArray[2].src = "portaldata/1/images/navigation/product_right.gif";

//left image
imgArrayActive[0] = new Image();
imgArrayActive[0].src = "portaldata/1/images/navigation/product_left_active.gif";
//middle image
imgArrayActive[1] = new Image();
imgArrayActive[1].src = "portaldata/1/images/navigation/product_active.gif";
//right
imgArrayActive[2] = new Image();
imgArrayActive[2].src = "portaldata/1/images/navigation/product_right_active.gif";

function changeProductContent(objSender, objSourceId)
{
    
    v = "productTabText_"+objSender.id.replace("productTab_", "");
    changeProductContentDiv(v);
    setTimeout("changeImage('"+objSender.id+"', "+objSourceId+")", 100);
}

function changeImage(objSender, objSourceId)
{
	objParent = document.getElementById('productTabContainer');
	if(objParent)
    {
        elems = objParent.getElementsByTagName('div');
        
        for(i=0; i<elems.length; i++)
        {
            //add = (elems[i].id == objSender.id) ? "_active.gif" : ".gif"
			if(elems[i].id.indexOf("productTab_")==0)
			{
				if(elems[i].id == objSender)
				{
					elems[i].style.backgroundImage = "url("+imgArrayActive[1].src+")";
					for(z=0;z<elems[i].childNodes.length; z++)
					{
						if(elems[i].childNodes[z].src && elems[i].childNodes[z].className!="tabIcon")
							elems[i].childNodes[z].src = (elems[i].childNodes[z].src.indexOf("_right")>0) 
							? imgArrayActive[2].src //right
							: imgArrayActive[0].src // left 
					}
				}
				else
				{
					elems[i].style.backgroundImage = "url("+imgArray[1].src+")";
					for(z=0;z<elems[i].childNodes.length; z++)
					{
						if(elems[i].childNodes[z].src && elems[i].childNodes[z].className!="tabIcon")
							elems[i].childNodes[z].src = (elems[i].childNodes[z].src.indexOf("_right")>0) 
							? imgArray[2].src //right
							: imgArray[0].src // left 
					}
				}
			}
        }
    }
}


function changeProductContentDiv(objSourceId)
{
    objDest = document.getElementById('productTabContent');
    source = document.getElementById(objSourceId);
    //objDest.innerHTML = source.innerHTML
    
    found = false
    for(i=0; i<objDest.childNodes.length;i++)
    {
		if(objDest.childNodes[i]==objSourceId)	
		{
			objDest.childNodes[i].style.display="block";
			found=true;
		}
		else
			objDest.childNodes[i].style.display="none";
    }
    
    if(!found)
    {
		source.style.display="block";
		source.parentNode.removeChild( source )
		objDest.appendChild( source )
    }
}

function prepareProducts()
{
    objParent = document.getElementById('productTabContainer');
    if(objParent)
    {
        elems = objParent.getElementsByTagName('div');
        firstFound = false;
        firstTabFound = false;
        isBgSet = false;
        bwVersion = getBrowserVersion();
        
        for(i=0; i<elems.length; i++)
        {
            if(elems[i].id.indexOf("productTab_")==0)
            {
                //check if first not found
                if(!firstFound)
                    elems[i].style.backgroundImage = "url(portaldata/1//images/navigation/product_active.gif)";
                //get imags
                imgElems = elems[i].getElementsByTagName('img');
                for(z=0;z<imgElems.length; z++)
                {
                    //if IE 6 and is tabIcon fix png
                    if(bwVersion <= 6 && imgElems[z].className=="tabIcon" && imgElems[z].src.indexOf("?raid=")>0 )
                        fixPngImage(imgElems[z])
                        
                    if(!firstFound && imgElems[z].className=="tabLayoutImg")
                    {
                        imgElems[z].src = (imgElems[z].src.indexOf("_right")>0) 
                            ? "portaldata/1/images/navigation/product_right_active.gif" 
                            : "portaldata/1/images/navigation/product_left_active.gif"
                    }
                }
            }
            
            if(elems[i].id.indexOf("productTabText_")==0)
            {
               if(!firstFound ) {
                //alert("found "+i+" "+elems.length)
                changeProductContentDiv(elems[i].id)
                firstFound = true;
               }
               else
				elems[i].style.display = "none";
            }
            
        }
    }
}

function fixPngImage(obj)
{
	obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, src='" + obj.src + "')";
	obj.src = "portaldata/1/images/leer.gif";
}

function getBrowserVersion()
{
	//test for MSIE x.x;
	var myReg = /MSIE (\d+\.\d+);/
	if ( myReg.test(navigator.userAgent) )
		return new Number(RegExp.$1);
	else
		return 7;
	
}

function setSolutionImage(imgSrc)
{
    obj = document.getElementById('solutionTabImage')
    if(obj)
        obj.src = imgSrc;
}

function showHideObject(objShowId, objHideId)
{
	document.getElementById(objShowId).style.display = "block";
	document.getElementById(objHideId).style.display = "none";
}


/***** XML and Drop Downs ******/
function loadChildNodes(url, objDDL, isSpec)
{
	ind = http_request.length;
	loadXMLNodes(url, ind, objDDL, isSpec);
}
var selectedIndex=""; 
var http_request = new Array()
function loadXMLNodes(url,ind, objDDL, isSpec) 
{
    http_request[ind] = false;
    if (window.XMLHttpRequest) 
	{ // Mozilla, Safari,...
        http_request[ind] = new XMLHttpRequest();
        if (http_request[ind].overrideMimeType) 
			http_request[ind].overrideMimeType('text/xml');
      
    } 
    else if (window.ActiveXObject) 
    { // IE
        try 
        {
			http_request[ind] = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (e) 
        {
			try 
			{
				http_request[ind] = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e) {}
        }
    }
    
    if (!http_request[ind]) 
    {
        alert('Cannot create XMLHTTP instance');
        return false;
    }
    var d = new Date()
    if(isSpec)
		http_request[ind].onreadystatechange = function() { addSpecNodes(ind, objDDL) }; //specialities
	else
		http_request[ind].onreadystatechange = function() { addNodes(ind, objDDL) }; //finder
    separator = (url.indexOf("?")>0) ? "&" : "?";
    //alert(url+separator+d.toUTCString())
    http_request[ind].open('GET', url+separator+d.toUTCString(), true);
    http_request[ind].send(null);
}

function removeOptions(ddl)
{
	z = ddl.options.length-1
	for(;z>0;z--)
	{
		ddl.remove(z)
	}
}

function createOption(ddl, val, text, selectedValue)
{
	if(ddl)
	{
		var newOption = new Option(val,text);
		if(text==selectedValue)
			newOption.selected = true;
		ddl.options[ddl.options.length]=newOption;
	}
}

var CONST_SPEC_INDUSTRY_CATID = 360
var CONST_SPEC_SOLUTION_CATID = 361

function addSpecNodes(ind, objDDL) 
{
    if (http_request[ind].readyState == 4) 
    {
        if (http_request[ind].status == 200) 
        {
			//alert(parentNode.getAttribute("sibIndex"))
			var xmldoc = http_request[ind].responseXML;
			//get 
			var root = xmldoc.getElementsByTagName('Category');
			//open
			//parentNode.setAttribute("expanded", true)
			if(root && root.length>0)
			{
				//get ind 
				ddlIndustry = document.getElementById('ddlSpecIndustry')
				ddlIndustryValue = ddlIndustry.options[ddlIndustry.selectedIndex].value;
				if(objDDL!=ddlIndustry)
					removeOptions(ddlIndustry)
				//get solutions
				ddlSolution = document.getElementById('ddlSpecSolution')
				ddlSolutionValue = ddlSolution.options[ddlSolution.selectedIndex].value;
				if(objDDL!=ddlSolution)
					removeOptions(ddlSolution)
				
				for(i=0; i<root.length; i++)
				{
					var ddl=null;
					var selectedValue=null;
					attParentId = root[i].getAttribute("parentID");
					if(attParentId==CONST_SPEC_INDUSTRY_CATID)
					{
						ddl = ddlIndustry;	
						selectedValue = ddlIndustryValue;
					}
					else if(attParentId==CONST_SPEC_SOLUTION_CATID)
					{
						ddl = ddlSolution;
						selectedValue = ddlSolutionValue;
					}
					
					
					if(ddl && objDDL!=ddl)
					{
						//alert(ddl.id)
						createOption(ddl, root[i].getAttribute("title"), root[i].getAttribute("categoryID"), selectedValue )
					}
				}
				
				if(objDDL==null)
				{
				    selectItem('ddlIndustry')
				    selectItem('ddlSolution')
				}
			}
        } 
        else 
        {
			alert('There was a problem with the request.'+http_request[ind].statusText);
        }//end http_request.status
    }//end http_request.readyState == 4
}



var CONST_INDUSTRY_CATID = 3
var CONST_SOLUTION_CATID = 330


function addNodes(ind, objDDL) 
{
    if (http_request[ind].readyState == 4) 
    {
        if (http_request[ind].status == 200) 
        {
			//alert(parentNode.getAttribute("sibIndex"))
			var xmldoc = http_request[ind].responseXML;
			//get 
			var root = xmldoc.getElementsByTagName('Category');
			//open
			//parentNode.setAttribute("expanded", true)
			if(root && root.length>0)
			{
				//get ind 
				ddlIndustry = document.getElementById('ddlIndustry')
				ddlIndustryValue = ddlIndustry.options[ddlIndustry.selectedIndex].value;
				if(objDDL!=ddlIndustry)
					removeOptions(ddlIndustry)
				//get ind sub
				ddlIndustrySub = document.getElementById('ddlIndustrySub')
				ddlIndustrySubValue = ddlIndustrySub.options[ddlIndustrySub.selectedIndex].value;
				if(objDDL!=ddlIndustrySub)
					removeOptions(ddlIndustrySub)
				//get solutions
				ddlSolution = document.getElementById('ddlSolution')
				ddlSolutionValue = ddlSolution.options[ddlSolution.selectedIndex].value;
				if(objDDL!=ddlSolution)
					removeOptions(ddlSolution)
				//get solutions sub
				ddlSolutionSub = document.getElementById('ddlSolutionSub')
				ddlSolutionSubValue = ddlSolutionSub.options[ddlSolutionSub.selectedIndex].value;
				if(objDDL!=ddlSolutionSub)
					removeOptions(ddlSolutionSub)
				
				for(i=0; i<root.length; i++)
				{
					var ddl=null;
					var selectedValue=null;
					attParentId = root[i].getAttribute("parentID");
					attParentParentId = root[i].getAttribute("parentParentID");
					if(attParentId==CONST_INDUSTRY_CATID)
					{
						ddl = ddlIndustry;	
						selectedValue = ddlIndustryValue;
					}
					else if(attParentId!=CONST_INDUSTRY_CATID && attParentParentId==CONST_INDUSTRY_CATID)
					{
						ddl = ddlIndustrySub;
						selectedValue = ddlIndustrySubValue;
					}
					else if(attParentId==CONST_SOLUTION_CATID)
					{
						ddl = ddlSolution;
						selectedValue = ddlSolutionValue;
					}
					else if(attParentId!=CONST_SOLUTION_CATID && attParentParentId==CONST_SOLUTION_CATID)
					{
						ddl = ddlSolutionSub;
						selectedValue = ddlSolutionSubValue;
					}
					
					if(ddl && objDDL!=ddl)
					{
						createOption(ddl, root[i].getAttribute("title"), root[i].getAttribute("categoryID"), selectedValue )
					}
				}
				
				if(objDDL==null)
				{
				    res = selectItem('ddlIndustry')
				    if(res)
                        document.getElementById('ddlIndustrySub').disabled=false
                    selectItem('ddlIndustrySub')
                    
                        
                    res = selectItem('ddlSolution')
                    if(res)
                        document.getElementById('ddlSolutionSub').disabled=false
                    selectItem('ddlSolutionSub')
                    
				}
			}
        } 
        else 
        {
			alert('There was a problem with the request.'+http_request[ind].statusText);
        }//end http_request.status
    }//end http_request.readyState == 4
}

function changeSpecDropDown(host, objDDL)
{
	obj0 = document.getElementById('ddlSpecIndustry')
	obj2 = document.getElementById('ddlSpecSolution')
	
	val0 = obj0.options[obj0.selectedIndex].value
	val2 = obj2.options[obj2.selectedIndex].value
	
	addUrl = ''
	addCategoriesUrl = ''
	if(val0.length>0)
	{
		addUrl = "c0="+val0;
		addCategoriesUrl = val0;
	}
	if(val2.length>0)
	{
		addUrl += (addUrl.length>0) ? "&c2="+val2 : "c2="+val2;
		addCategoriesUrl += (addCategoriesUrl.length>0) ? ","+val2 : val2;
	}
		
	loadChildNodes(host+"/products/portaldata/1/kwitPages/startpageFinder.aspx?parentId=359&solutionId=361&industrieId=360&categories="+addCategoriesUrl+"&"+addUrl, objDDL, true);
}

function changeDropDown(host, objDDL)
{
	obj0 = document.getElementById('ddlIndustry')
	obj1 = document.getElementById('ddlIndustrySub')
	obj2 = document.getElementById('ddlSolution')
	obj3 = document.getElementById('ddlSolutionSub')
	
	val0 = obj0.options[obj0.selectedIndex].value
	//clear selection inside of sub dropdown
	if(val0.length==0) 
	{
		obj1.selectedIndex = 0;
		obj1.disabled=true;
	}
	val1 = obj1.options[obj1.selectedIndex].value
	val2 = obj2.options[obj2.selectedIndex].value
	//clear selection inside of sub dropdown
	if(val2.length==0)
	{
		obj3.selectedIndex = 0;
		obj3.disabled=true;
	}
    val3 = obj3.options[obj3.selectedIndex].value
	
	addUrl = ''
	addCategoriesUrl = ''
	if(val0.length>0)
	{
		addUrl = "c0="+val0;
		addCategoriesUrl = val0;
	}
	if(val1.length>0)
	{
		addUrl += (addUrl.length>0) ? "&c1="+val1 : "c1="+val1;
		addCategoriesUrl += (addCategoriesUrl.length>0) ? ","+val1 : val1;
	}
	if(val2.length>0)
	{
		addUrl += (addUrl.length>0) ? "&c2="+val2 : "c2="+val2;
		addCategoriesUrl += (addCategoriesUrl.length>0) ? ","+val2 : val2;
	}
	if(val3.length>0)
	{
		addUrl += (addUrl.length>0) ? "&c3="+val3 : "c3="+val3;
		addCategoriesUrl += (addCategoriesUrl.length>0) ? ","+val3 : val3;
	}
		
	loadChildNodes(host+"/products/portaldata/1/kwitPages/startpageFinder.aspx?categories="+addCategoriesUrl+"&"+addUrl, objDDL, false);
	
	if(val0.length>0) 
	    obj1.disabled=false;
	if(val2.length>0)
	    obj3.disabled=false;
}

/*** sustainability ***/
function setOnLoad(val)
{
	var sTemp = "";
	if(window.onload != null) {
      sTemp = window.onload.toString();
      iStart = sTemp.indexOf("{") + 2;
      sTemp = sTemp.substr(iStart,sTemp.length-iStart-2);
      
      
    }
    if (sTemp.indexOf(val) == -1)
    {
      window.onload = new Function(val + sTemp);
    }
}


function showSustainability(oId)
{
    objParent = document.getElementById('sustainabilityItemsNavigation');
    if(objParent)
    {
        elemsA = objParent.getElementsByTagName('a');
        for(i=0; i<elemsA.length; i++)
        {
            if( elemsA[i].id=="sustainabilityTitle_"+oId )
                elemsA[i].className="sustainabilityTitleActive";
            else
                elemsA[i].className="sustainabilityTitle";
        }
    }
    
    changeSustainabilityContentDiv(document.getElementById("sustainabilityText_"+oId))
}

function changeSustainabilityContentDiv(source)
{
    objDest = document.getElementById('sustainabilityText');
    
    found = false
    for(i=0; i<objDest.childNodes.length;i++)
    {
		if(objDest.childNodes[i]==source.id)	
		{
			objDest.childNodes[i].style.display="block";
			found=true;
		}
		else
			objDest.childNodes[i].style.display="none";
    }
    
    if(!found)
    {
		source.style.display="block";
		source.parentNode.removeChild( source )
		objDest.appendChild( source )
	}
}

function prepareSustainability()
{
    objParent = document.getElementById('sustainabilityItemsNavigation');
    if(objParent)
    {
        elems = objParent.getElementsByTagName('div');
        elemsA = objParent.getElementsByTagName('a');
        oToPut=null;
        for(i=0; i<elems.length; i++)
        {
            if(elems[i].id.indexOf("sustainabilityText_")==0)
            {
               if(!oToPut) 
               {
                oToPut = elems[i];
                elemsA[i].className="sustainabilityTitleActive";
               }
               else
				elems[i].style.display = "none";
            }
        }
        if(oToPut)
            changeSustainabilityContentDiv(oToPut);
    }
}

function prepareSustainabilityStart()
{
	objParent = document.getElementById('sustDetailContainer');
	
	if(objParent)
	{
		elems = objParent.getElementsByTagName('div');
		firstSelected = false;
		for(i=0,z=1; i<elems.length; i++, z++)
        {
            if(elems[i].id.indexOf("sust")==0)
            {
				if(!firstSelected) 
				{
					firstSelected = true;
					continue;
				}
				
				elems[i].style.display = "none";
				document.getElementById('sustInfo'+z).style.display = "none";
            }
        }
	}
}

function changeSustainability(obj)
{
	objParent = document.getElementById('sustDetailContainer');
	if(objParent)
	{
		elems = objParent.getElementsByTagName('div');
		toCheck = (obj.selectedIndex+1)
		for(i=0,z=1; i<elems.length; i++, z++)
        {
			if(z==toCheck)
			{
				elems[i].style.display = "block";
				document.getElementById('sustInfo'+z).style.display = "block";
			}
			else
			{
				elems[i].style.display = "none";
				document.getElementById('sustInfo'+z).style.display = "none";
			}
        }
	}
}

function makeSustainabilityLinksActive()
{
	objParent = document.getElementById('sustainabilityLinks');
	if( objParent && (index=document.location.href.indexOf("tabid-")) > -1 )
    {
        iTabId = document.location.href.substring(index+6, document.location.href.length);
		
		elems = objParent.getElementsByTagName('a');
		for(i=0; i<elems.length; i++)
        {
			if( elems[i].href.indexOf("tabid-"+iTabId)>=0 )
				elems[i].parentNode.className="active"
			else
				elems[i].parentNode.className=""
        }
	}
}

function showOnMouse(objIdShow, objIdHide)
{
	oShow = document.getElementById(objIdShow)
	oHide = document.getElementById(objIdHide)
	
	pos = findPos(Content);
	
	oShow.style.display = (oShow.style.display!="block") ? "block" : "none";
	oShow.style.top = pos[0]+300 
	oShow.style.left = pos[3]+320;
	
	oHide.style.display = "none";
}

/*
Bookmark - Favorites
*/
function book_mark(adresse, adresstitel, book_mark_error) {
	bname = navigator.appName;
	if (bname.indexOf("Netscape") != -1) {
		window.parent.location = adresse;
		alert(book_mark_error);
		return;
	}
	if (bname.indexOf("Microsoft") != -1) {
		window.external.AddFavorite(adresse, adresstitel)
		return;
	}
}

function showTeaserNew(objId) {
	var teaser = document.getElementById(objId).getElementsByTagName("a");
	var visibleElement = Math.round(Math.random() * (teaser.length - 1));
	for (i = 0; i < teaser.length; i++) {
		if (i == visibleElement)
			teaser[i].style.display = "block";
		else
			teaser[i].style.display = "none";
	}
}
