﻿function OpenSoftDownloadPage()
{
	ResetDownloadFoldStyle();
	window.parent.main.location = 'ProductsPage/SoftwareDownloadsPage.htm?IsInner=0'
	ResetBottom(1)
	document.getElementById("Download1n0").style.fontWeight = "bolder";
}

function OpenMarketMaterialsPage()
{
	ResetDownloadFoldStyle();
	window.parent.main.location = 'ProductsPage/MarketMaterialsPage.htm?IsInner=0'
	ResetBottom(1)
	document.getElementById("Download1n1").style.fontWeight = "bolder";
}

function ResetDownloadFoldStyle()
{
	document.getElementById("Download1n0").style.fontWeight = "normal";
	document.getElementById("Download1n1").style.fontWeight = "normal";
}


function SetLeftBarginColor()
{
	var leftBarginType = parseInt(getCookie("leftBarginColor"));
	if (leftBarginType == 1)
		document.getElementById("leftBarginColor").style.backgroundColor="#E7E7E7";
	else if (leftBarginType == 2)
		document.getElementById("leftBarginColor").style.backgroundColor="#FFFFFF";
	else
		document.getElementById("leftBarginColor").style.backgroundColor="#E7E7E7";
}

function ResetBottom(colorType)
{  
   setCookie("leftBarginColor",colorType);
   window.parent.bottem.location = 'Bottom.htm?IsInner=0'
}

function ResetBottomFromChildFolder(colorType)
{  
   setCookie("leftBarginColor",colorType);
   window.parent.bottem.location = '../Bottom.htm?IsInner=0'
}


function OpenProduct()
{
	document.getElementById("img1").src="Image/buttonEF.jpg";
	document.getElementById("img3").src="Image/button115.jpg";
	document.getElementById("img4").src="Image/button119.jpg";
	document.getElementById("img5").src="Image/button123.jpg";

	window.parent.contents.location = 'LeftProducts.htm?IsInner=0';
	setCookie("headerItem",1);
	window.parent.main.location = 'ProductsPage/HARcadStrengthsPage.htm?IsInner=0';
	ResetBottom(1)
}

function OpenProductFromHardcad()
{
	parent.document.getElementById("banner").contentWindow.document.getElementById("img1").src="Image/buttonEF.jpg";
	parent.document.getElementById("banner").contentWindow.document.getElementById("img3").src="Image/button115.jpg";
	parent.document.getElementById("banner").contentWindow.document.getElementById("img4").src="Image/button119.jpg";
	parent.document.getElementById("banner").contentWindow.document.getElementById("img5").src="Image/button123.jpg";

	window.parent.contents.location = 'LeftProducts.htm?IsInner=0';
	setCookie("headerItem",1);
	window.parent.main.location = 'ProductsPage/HARcadStrengthsPage.htm?IsInner=0';
	window.parent.banner.location = 'Header.htm?IsInner=0';
	ResetBottom(1);
}

function OpenProductFromFunctionality()
{
	window.parent.contents.location = '../LeftProducts.htm?SelectedItem=1;ChildItem=0';
	setCookie("headerItem",1);
	ResetBottomFromChildFolder(1)
}



function OpenLeftHome()
{
	window.parent.main.location = 'HomePage.htm?IsInner=0'
	
	setCookie("homeItem",0);
	ResetBottom(1)
}

function OpenHome()
{
	document.getElementById("img2").src="Image/button107.jpg"
	document.getElementById("img3").src="Image/button115.jpg"
	document.getElementById("img4").src="Image/button119.jpg"
	document.getElementById("img5").src="Image/button123.jpg"

	window.parent.main.location = 'HomePage.htm?IsInner=0'
	window.parent.contents.location = 'LeftHome.htm?IsInner=0'
	setCookie("homeItem",0);
	setCookie("headerItem",0);
	ResetBottom(1)
}

function OpenDownLoad()
{
	document.getElementById("img1").src="Image/buttonEF.jpg"
	document.getElementById("img2").src="Image/button107.jpg"
	document.getElementById("img4").src="Image/button119.jpg"
	document.getElementById("img5").src="Image/button123.jpg"

   window.parent.main.location = 'DownLoadPage.htm?IsInner=0'
   window.parent.contents.location = 'LeftDownLoad.htm?IsInner=0'

   setCookie("headerItem",2);
   setCookie("downLoadItem",0);
   ResetBottom(1)
}

function OpenLeftDownLoad()
{
	window.parent.main.location = 'DownLoadPage.htm?IsInner=0'
	setCookie("downLoadItem",0);
	ResetBottom(1)
}

function OpenService()
{
	document.getElementById("img1").src="Image/buttonEF.jpg"
	document.getElementById("img2").src="Image/button107.jpg"
	document.getElementById("img3").src="Image/button115.jpg"
	document.getElementById("img5").src="Image/button123.jpg"

	window.parent.main.location = 'ServicePage.htm?IsInner=0'
	window.parent.contents.location = 'LeftService.htm?IsInner=0'
	setCookie("headerItem",3);
	setCookie("serviceItem",0);
	ResetBottom(1)
}

function OpenLeftService()
{
	window.parent.main.location = 'ServicePage.htm?IsInner=0'
	setCookie("serviceItem",0);
	ResetBottom(1)
}

function OpenAboutUs()
{
	document.getElementById("img1").src="Image/buttonEF.jpg"
	document.getElementById("img2").src="Image/button107.jpg"
	document.getElementById("img3").src="Image/button115.jpg"
	document.getElementById("img4").src="Image/button119.jpg"

   window.parent.main.location = 'AboutUsPage.htm?IsInner=0'
   window.parent.contents.location = 'LeftAboutUs.htm?IsInner=0'

   setCookie("headerItem",4);
   setCookie("aboutUsItem",0);
   ResetBottom(1)
}

function OpenLeftAboutUs()
{
   window.parent.main.location = 'AboutUsPage.htm?IsInner=0'
   setCookie("aboutUsItem",0);
   ResetBottom(1)
}

function ResetHeaderButtonImage()
{
	parent.document.getElementById("banner").contentWindow.document.getElementById("img1").src="Image/buttonEF.jpg"
	parent.document.getElementById("banner").contentWindow.document.getElementById("img2").src="Image/button107.jpg"
	parent.document.getElementById("banner").contentWindow.document.getElementById("img3").src="Image/button115.jpg"
	parent.document.getElementById("banner").contentWindow.document.getElementById("img4").src="Image/button119.jpg"
	parent.document.getElementById("banner").contentWindow.document.getElementById("img5").src="Image/button123.jpg"
	setCookie("headerItem",-1);
}

function OpenContactFromHeader()
{
	ResetHeaderButtonImage();
	window.parent.main.location = 'ContactPage.htm?IsInner=0'
	
	setCookie("contactItem",0);
	window.parent.contents.location = 'LeftContactPage.htm?IsInner=0'
	ResetBottom(1)
}


function OpenContact()
{
	window.parent.main.location = 'ContactPage.htm?IsInner=0'
	
	setCookie("contactItem",0);
	ResetBottom(1)
}

function OpenImprint()
{
	ResetHeaderButtonImage();
	window.parent.main.location = 'ImprintPage.htm?IsInner=0'
	
	setCookie("introduceItem",0);
	window.parent.contents.location = 'LeftCompanyIntroduce.htm?IsInner=0'
	ResetBottom(1)
}

function OpenProductsPage(treeViewId,productsPageUrl)
{
	ResetFunctionFoldStyle();
	document.getElementById(treeViewId).style.fontWeight = "bolder";
	window.parent.main.location = productsPageUrl
	ResetBottom(1)
}


//************Common function***********************//
function GetSuffixValueFromPageSource()
{
	var returnArray = new Array();
	var curLocationHref = document.location.href.split("?");
	if (curLocationHref.length>1)
	{
		var paramater = curLocationHref[1].split(";");
		if (paramater.length>0)
		{
			for (var index=0; index<paramater.length; index++)
			{
				var childValue = paramater[index];
				var childValues = childValue.split("=");
				if (childValues.length>0)
				{
					returnArray[index] = childValues[0];
					index++;
					returnArray[index] = childValues[1];
				}
			}
		}
	}
	return returnArray;
}


function setCookie(sName,sValue) { 
    var cookieString = sName + "=" + escape(sValue); 
    document.cookie = cookieString; 
}

function setHeadCookie(sName,sValue) { 
    var cookieString = sName + "=" + escape(sValue);  
    parent.document.getElementById("banner").contentWindow.document.cookie = cookieString; 
}

function setBottomCookie(sName,sValue) { 
    var cookieString = sName + "=" + escape(sValue); 
    window.parent.bottem.cookie = cookieString; 
}

function getCookie(sName) { 
  var aCookie = document.cookie.split("; "); 
  for (var j=0; j < aCookie.length; j++)
  { 
    var aCrumb = aCookie[j].split("="); 
    if (escape(sName) == aCrumb[0]) 
      return unescape(aCrumb[1]); 
  } 
  return null; 
}

//compare current value to cookie "maxFrameHeight" value
function CheckFrameMaxHeightAndAddToCookie(curFrameHeight)
{
	var curMaxFrameHeight = GetMaxMainFrameIniHeight();
	if(curFrameHeight > curMaxFrameHeight)
	{
		setCookie("maxFrameHeight",curFrameHeight);
		return true;
	}
	else return false;
}

//get cookie "maxFrameHeight" value
function GetMaxMainFrameIniHeight()
{
	var curMaxFrameHeight = getCookie("maxFrameHeight");
	if (curMaxFrameHeight != null)
		return curMaxFrameHeight;
	else return (contentFrameHeight - bottomHeight);
}

//************Ini Main Iframe with multi pans***********************//
function adjustMultiPansParentMainIframeHeight(isProductsPage)
{ 
	
	var a = parent.document.getElementById("main"); 
	if(a.contentWindow==window)
	{ 
		//adjust height	
		adjustMultiPansMainIFrameHeight(a,isProductsPage);
	}
} 


function adjustMultiPansMainIFrameHeight(iframeObj,isProductsPage,extHeight)
{ 
	var h1=0, h2=0; 
	var iframeDoc = iframeObj.contentWindow.document;
	iframeObj.style.height=contentFrameHeight-bottomHeight;
 	
	if(iframeDoc.documentElement&&iframeDoc.documentElement.scrollHeight) 
	{ 
		h1=iframeDoc.documentElement.scrollHeight; 
	} 
	if(iframeDoc.body) h2=iframeDoc.body.scrollHeight; 
	var h=Math.max(h1, h2);
	
	var hSum = 0
	hSum = h + bottomHeight;

	if(contentFrameHeight>hSum)
	{
		hSum=contentFrameHeight;
		h = contentFrameHeight-bottomHeight;
	}
	var allPanHeight = 0;
	if (isProductsPage == true)
	{
		allPanHeight = parseInt(getCookie("allPanHeight"));
	}
	if(allPanHeight == null) {allPanHeight = 0;}
	
	if(allPanHeight>hSum)
	{
		h = allPanHeight - bottomHeight;
	}
	if(extHeight==null){ extHeight = 0;} 
	iframeObj.style.height = iframeObj.parentNode.style.height = h + extHeight + "px"; 
	parent.document.getElementById("contents").style.height = h + extHeight + bottomHeight + "px";

	setCookie("maxFrameHeight",h);
}


//************Ini Main Iframe***************//
function adjustParentMainIframeHeight(framePageNum,isProductsPage)
{ 
	var returnArray = GetSuffixValueFromPageSource()
	if (returnArray == null || returnArray.length <2)
	{
		if (framePageNum == 1)
		{
			window.location = "../index.htm?selectedItem=0";
		}
		else
		{
			window.location = "../../index.htm?selectedItem=0";
		}
		return 0;
	}
	var a = parent.document.getElementById("main"); 
	if(a.contentWindow==window)
	{ 
		//adjust height	
		adjustMainIFrameHeight(a,isProductsPage);
	}
} 


function adjustMainIFrameHeight(iframeObj,isProductsPage,extHeight)
{ 
	var h1=0, h2=0; 
	var iframeDoc = iframeObj.contentWindow.document;
	iframeObj.style.height=contentFrameHeight-bottomHeight;
	if(iframeDoc.documentElement&&iframeDoc.documentElement.scrollHeight) 
	{ 
		h1=iframeDoc.documentElement.scrollHeight; 
	}
	
	if(iframeDoc.body) h2=iframeDoc.body.scrollHeight; 

	var h=Math.max(h1, h2);
	
	var hSum = 0
	hSum = h + bottomHeight;

	if(contentFrameHeight>hSum)
	{
		hSum=contentFrameHeight;
		h=contentFrameHeight-bottomHeight;
	}
	if(extHeight==null){ extHeight = 0;} 
	iframeObj.style.height = iframeObj.parentNode.style.height = h + extHeight + "px"; 
	setCookie("maxFrameHeight",h);
}




//************Create LeftProducts page***********************//

//************create open multi pans ***********************//
//adjust height of current iframe
var contentFrameHeight = 666; //the height of iframe "content"
var bottomHeight = 35; //the height of iframe "bottem". if iframe height is changed,modify this value
//var allPanHeight = 0; //the height sum of all panes in page "LeftService"
//var maxFrameHeight = 666; //the max height of iframe "content" and "main"  + "bottom"
var layerTop=0;       //menu top margin
var layerLeft=0;      //menu left margin
var layerWidth=220;    //menu width
var titleHeight=26;    //title bar height

var myArray = new Array(61, 161, 101, 161, 81);//content height
var myTopArray = new Array(26,52,78,104,130,156);//top position
var myOpenMenu = new Array(1,0,0,0,0); //record opend menu: 1 opend; 0 closed

var itemNo=0;

function Pageload()
{
	 IniOpenMenu()
     if (myOpenMenu[0]==1) {moveDown(0); }
     if (myOpenMenu[1]==1) {moveDown(1); }
     if (myOpenMenu[2]==1) {moveDown(2); }
     if (myOpenMenu[3]==1) {moveDown(3); }
	 if (myOpenMenu[4]==1) {moveDown(4); }
	 //IniProductsLeftPageFont()
	 adjustParentProductsIframeHeight();
}

function IniOpenMenu()
{
	myOpenMenu[0] = parseInt(getCookie(0));
	myOpenMenu[1] = parseInt(getCookie(1));
	myOpenMenu[2] = parseInt(getCookie(2));
	myOpenMenu[3] = parseInt(getCookie(3));
	myOpenMenu[4] = parseInt(getCookie(4));
}

function countPosition(curItemNo)
{
	if (curItemNo == 0) return 0
	else {
		var sumValue = 0;
		for (i = 0; i < curItemNo ; i++) sumValue += mySinglePanArray[i];
		return sumValue 
	}
}

function addItem(itemTitle,itemContent){
   itemHTML='<div id=item'+itemNo+' itemIndex='+itemNo+' style="background-color:#E7E7E7; position:relative;left:0;top:'+
   		(-countPosition(itemNo))+';width:'+layerWidth+';"><table width=100% cellspacing="0" cellpadding="0">'+
       '<tr><td height='+titleHeight+' onclick=changeItemOfSinglePan('+itemNo+') class="titleStyle" align=center>'+itemTitle+'</td></tr>'
   itemHTML += '<tr><td height='+mySinglePanArray[itemNo]+' class="contentStyle">'+itemContent+'</td></tr>';
   
   itemHTML += '</table></div>'
   
   document.write(itemHTML);
   itemNo++;
}

function changeItem(clickItemIndex){
if (parseInt(myTopArray[clickItemIndex+1]-myTopArray[clickItemIndex])==26)
	moveDown(clickItemIndex);
else moveUp(clickItemIndex);
document.location.reload();
}

function moveUp(clickItemIndex)
{
	var curDocumentStyleHeight = document.all.itemsLayer.style.height;
	document.all.itemsLayer.style.height=parseInt(curDocumentStyleHeight)-myArray[clickItemIndex];
	for(i=clickItemIndex+1;i<=4;i++)
	{
		eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)-myArray['+clickItemIndex+'];');
		myTopArray[i] -= myArray[clickItemIndex]
	}
	myTopArray[5] -= myArray[clickItemIndex]
	myOpenMenu[clickItemIndex] = 0
	setCookie(clickItemIndex,0)
	var allPanHeight = parseInt(document.all.itemsLayer.style.height);
	setCookie("allPanHeight",allPanHeight);
}

function moveDown(clickItemIndex)
{
	var curDocumentStyleHeight = document.all.itemsLayer.style.height;
	document.all.itemsLayer.style.height =parseInt(curDocumentStyleHeight)+myArray[clickItemIndex];
	for(i=clickItemIndex+1;i<=4;i++)
	{
		eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)+myArray['+clickItemIndex+'];');
		myTopArray[i] += myArray[clickItemIndex]
	}
	myTopArray[5] += myArray[clickItemIndex]
	myOpenMenu[clickItemIndex] = 1
	setCookie(clickItemIndex,1)
	var allPanHeight = parseInt(document.all.itemsLayer.style.height);
	setCookie("allPanHeight",allPanHeight);
}



function adjustParentProductsIframeHeight()
{ 
	var a = parent.document.getElementById("contents"); 
	if(a.contentWindow==window)
	{ 
		//adjust height	
		adjustProductsIFrameHeight(a);
	}
} 


function adjustProductsIFrameHeight(iframeObj, extHeight)
{ 
	var h1=0, h2=0; 
	var iframeDoc = iframeObj.contentWindow.document;  
	if(iframeDoc.documentElement&&iframeDoc.documentElement.scrollHeight) 
	{ 
		h1=iframeDoc.documentElement.scrollHeight; 
	} 
	
	if(iframeDoc.body) h2=iframeDoc.body.scrollHeight; 
	var h=Math.max(h1, h2);
	
	var maxH=GetMaxMainFrameIniHeight();

	maxH = parseInt(bottomHeight) + parseInt(maxH);

	if(h<maxH)
	{
		h = maxH;
	}
	var allPanHeight = parseInt(getCookie("allPanHeight"));
	if(allPanHeight == null) allPanHeight = 0;
	if(allPanHeight>maxH)
	{
		h = allPanHeight;
	}
	else h = maxH;
	
	if(extHeight==null){ extHeight = 0;} 
	iframeObj.style.height = iframeObj.parentNode.style.height = h + extHeight + "px";
	parent.document.getElementById("main").style.height = h + extHeight - bottomHeight + "px";
} 


//************Create LeftProducts page***********************//

//************create open single pans ***********************//
var singlePanTitleHeight=26;    //title bar height
var mySinglePanTopArray = new Array(26,52,78,104);//top position
//var mySinglePanArray = new Array(47, 190, 110, 90);//content height
var mySinglePanArray = new Array(50, 196, 90);//content height

function SinglePanPageLoad()
{
	var returnArray = GetSuffixValueFromPageSource()
	if (returnArray != null)
	{
		if (returnArray.length=4)
		{
			var childItemValue=0;
			var selectedItemValue=-1;
			for(var index = 0;index<4;index++)
			{
				if (returnArray[index] == "SelectedItem")
				{
					index++;
					selectedItemValue = parseInt(returnArray[index])
				}
				else if (returnArray[index]== "ChildItem")
				{
					index++;
					childItemValue = parseInt(returnArray[index])
				}
			}
			switch(selectedItemValue)
			{
				case 0:
					changeItemOfSinglePan(0);
					break;
				case 1:
					changeItemOfSinglePan(1);
					break;
				case 2:
					changeItemOfSinglePan(2);
					break;
			}
		}
	}
}

function changeItemOfSinglePan(clickItemIndex)
{
	//resetOpenMenuArray();
	for(i=0;i<=2;i++)
	{
		if(i!=clickItemIndex)
		{
			if (parseInt(mySinglePanTopArray[i+1]-mySinglePanTopArray[i])==(singlePanTitleHeight+mySinglePanArray[i]))
				moveUpSinglePan(i);
		}
	}
	if (parseInt(mySinglePanTopArray[clickItemIndex+1]-mySinglePanTopArray[clickItemIndex])==singlePanTitleHeight)
	{
		if (clickItemIndex==0) 
		{		
			ResetFunctionFoldStyle();
			document.getElementById("TreeView1n1").style.fontWeight = "bolder";
			window.parent.main.location = 'ProductsPage/ProcesscoveredPage.htm?IsInner=0'
		}
		else if (clickItemIndex==1) 
		{
			ResetFunctionFoldStyle();
			document.getElementById("TreeView1n7").style.fontWeight = "bolder";
			window.parent.main.location = 'ProductsPage/ImportingPage.htm?IsInner=0'
		}
		else if (clickItemIndex==2)
		{
			ResetFunctionFoldStyle();
			window.parent.main.location = 'ProductsPage/AdditionalServicePage.htm?IsInner=0'
		}
		moveDownSinglePan(clickItemIndex);
	}
}

function ResetFunctionFoldStyle()
{
	document.getElementById("TreeView1n1").style.fontWeight = "normal";
	document.getElementById("TreeView1n3").style.fontWeight = "normal";
	document.getElementById("TreeView1n4").style.fontWeight = "normal";
	document.getElementById("TreeView1n5").style.fontWeight = "normal";
	document.getElementById("TreeView1n6").style.fontWeight = "normal";
	document.getElementById("TreeView1n7").style.fontWeight = "normal";
	document.getElementById("TreeView1n8").style.fontWeight = "normal";
	document.getElementById("TreeView1n9").style.fontWeight = "normal";
	document.getElementById("TreeView1n10").style.fontWeight = "normal";
	document.getElementById("TreeView1n11").style.fontWeight = "normal";
	document.getElementById("TreeView1n12").style.fontWeight = "normal";
}

function moveDownSinglePan(clickItemIndex)
{
	var curDocumentStyleHeight = document.all.itemsLayer.style.height;
	document.all.itemsLayer.style.height =parseInt(curDocumentStyleHeight)+mySinglePanArray[clickItemIndex];
	for(i=clickItemIndex+1;i<=2;i++)
	{
		eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)+mySinglePanArray['+clickItemIndex+'];');
		mySinglePanTopArray[i] += mySinglePanArray[clickItemIndex]
	}
	mySinglePanTopArray[3] += mySinglePanArray[clickItemIndex]
}

function moveUpSinglePan(clickItemIndex)
{
	var curDocumentStyleHeight = document.all.itemsLayer.style.height;
	document.all.itemsLayer.style.height=parseInt(curDocumentStyleHeight)-mySinglePanArray[clickItemIndex];
	for(i=clickItemIndex+1;i<=2;i++)
	{
		eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)-mySinglePanArray['+clickItemIndex+'];');
		mySinglePanTopArray[i] -= mySinglePanArray[clickItemIndex]
	}
	mySinglePanTopArray[3] -= mySinglePanArray[clickItemIndex]
}


//************Create LeftDownload page***********************//

var downloadPanTitleHeight=26;    //title bar height
var myDownloadPanTopArray = new Array(26,52,78);//top position
var myDownloadPanArray = new Array(56, 82);//content height
var downloadItemNo=0;


function addDownloadItem(itemTitle,itemContent){
   itemHTML='<div id=item'+downloadItemNo+' itemIndex='+downloadItemNo+' style="background-color:#E7E7E7; position:relative;left:0;top:'+
   		(-countDownloadPosition(downloadItemNo))+';width:'+layerWidth+';"><table width=100% cellspacing="0" cellpadding="0">'+
       '<tr><td height='+titleHeight+' onclick=changeItemOfDownloadPan('+downloadItemNo+') class="titleStyle" align=center>'+itemTitle+'</td></tr>'
   itemHTML += '<tr><td height='+myDownloadPanArray[downloadItemNo]+' class="contentStyle">'+itemContent+'</td></tr>';
   
   itemHTML += '</table></div>'

   document.write(itemHTML);
   downloadItemNo++;
}

function countDownloadPosition(curItemNo)
{
	if (curItemNo == 0) return 0
	else {
		var sumValue = 0;
		for (i = 0; i < curItemNo ; i++) sumValue += myDownloadPanArray[i];
		return sumValue 
	}
}


function DownloadPageLoad()
{
	var returnArray = GetSuffixValueFromPageSource()
	if (returnArray != null)
	{
		if (returnArray.length=4)
		{
			var childItemValue=0;
			var selectedItemValue=-1;
			for(var index = 0;index<4;index++)
			{
				if (returnArray[index] == "SelectedItem")
				{
					index++;
					selectedItemValue = parseInt(returnArray[index])
				}
				else if (returnArray[index]== "ChildItem")
				{
					index++;
					childItemValue = parseInt(returnArray[index])
				}
			}
			switch(selectedItemValue)
			{
				case 0:
					changeItemOfDownloadPan(0);
					break;
				case 1:
					changeItemOfDownloadPan(1);
					break;
			}
		}
	}
}


function changeItemOfDownloadPan(clickItemIndex)
{
	//resetOpenMenuArray();
	for(i=0;i<=1;i++)
	{
		if(i!=clickItemIndex)
		{
			if (parseInt(myDownloadPanTopArray[i+1]-myDownloadPanTopArray[i])==(downloadPanTitleHeight+myDownloadPanArray[i]))
			{
				moveUpDownloadPan(i);
			}
		}
	}
	if (parseInt(myDownloadPanTopArray[clickItemIndex+1]-myDownloadPanTopArray[clickItemIndex])==downloadPanTitleHeight)
	{
		if (clickItemIndex==0) 
		{		
			ResetDownloadFunctionFoldStyle();
			document.getElementById("Download1n1").style.fontWeight = "bolder";
			window.parent.main.location = 'ProductsPage/SoftwareDownloadsPage.htm?IsInner=0'
		}
		else if (clickItemIndex==1) 
		{
			ResetDownloadFunctionFoldStyle();
			document.getElementById("Download2n1").style.fontWeight = "bolder";
			window.parent.main.location = 'ProductsPage/MarketMaterialsPage.htm?IsInner=0'
		}
		moveDownDownloadPan(clickItemIndex);
	}
}

function ResetDownloadFunctionFoldStyle()
{
	document.getElementById("Download1n1").style.fontWeight = "normal";
	document.getElementById("Download1n2").style.fontWeight = "normal";
	document.getElementById("Download2n1").style.fontWeight = "normal";
	document.getElementById("Download2n2").style.fontWeight = "normal";
	document.getElementById("Download2n3").style.fontWeight = "normal";
}

function OpenDownloadPage(treeViewId,productsPageUrl)
{
	ResetDownloadFunctionFoldStyle();
	document.getElementById(treeViewId).style.fontWeight = "bolder";
	window.parent.main.location = productsPageUrl
	ResetBottom(1)
}


function moveDownDownloadPan(clickItemIndex)
{
	var curDocumentStyleHeight = document.getElementById("itemsLayer").style.height;
	document.all.itemsLayer.style.height =parseInt(curDocumentStyleHeight)+myDownloadPanArray[clickItemIndex];
	for(i=clickItemIndex+1;i<=1;i++)
	{
		eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)+myDownloadPanArray['+clickItemIndex+'];');
		myDownloadPanTopArray[i] += myDownloadPanArray[clickItemIndex]
	}
	myDownloadPanTopArray[2] += myDownloadPanArray[clickItemIndex]
}

function moveUpDownloadPan(clickItemIndex)
{
	var curDocumentStyleHeight = document.all.itemsLayer.style.height;
	document.all.itemsLayer.style.height=parseInt(curDocumentStyleHeight)-myDownloadPanArray[clickItemIndex];
	for(i=clickItemIndex+1;i<=1;i++)
	{
		eval('document.all.item'+i+'.style.top=parseInt(document.all.item'+i+'.style.top)-myDownloadPanArray['+clickItemIndex+'];');
		myDownloadPanTopArray[i] -= myDownloadPanArray[clickItemIndex]
	}
	myDownloadPanTopArray[2] -= myDownloadPanArray[clickItemIndex]
}
