var prd_Current = '';
var prd_CurrentPrd = '';

function prd_OpenCat() {
	if(document.getElementById('sh_cat_list').offsetHeight == 0) {
		Effect.SlideUp('sh_prd_content', { duration: 0.5 });
		Effect.SlideDown('sh_cat_list', { duration: 0.5 });
	    //prd_Current.style.display = 'block';
	    document.getElementById(prd_Current).style.display = 'none';
	    Effect.Appear(prd_Current);
	}
}

function prd_OpenCatSub(id) {
	var current = id;
	if(current != prd_Current) {
		if(prd_Current != '')
			Effect.Fade(prd_Current);
		
		Effect.Appear(current);
		prd_Current = current;
	}
}



function prd_ShowPrd(id) {
    document.getElementById("sh_product_desc").src = "ProductDesc.aspx?pd="+id;

	//if(prd_CurrrentPrd != '')
	//	Effect.Fade('sh_prd_right', { duration: 0.5 });
	
	//document.getElementById('sh_prd_title').innerHTML = 'Product ' + id;
	Effect.Appear('sh_prd_right_outside', { duration: 0.5 });
	
	prd_CurrrentPrd = id;
}



function prd_OpenPrd(CategoryID, ManufacturerID, PageID, LanguageID) {
    document.getElementById("sh_product_list").src = "ProductList.aspx?cat="+CategoryID+"&mnf="+ManufacturerID+"&pg="+PageID+"&lg="+LanguageID;

    document.getElementById("sh_product_desc").src = "ProductDesc.aspx";
    document.getElementById("sh_prd_right_outside").style.display = "none";

	Effect.SlideUp('sh_cat_list');
	Effect.SlideDown('sh_prd_content');
}



function ajaxLoader(url,id) {
  if (document.getElementById) {
    var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
  }
  if (x) {
    x.onreadystatechange = function() {
      if (x.readyState == 4 && x.status == 200) {
				el = document.getElementById(id);
				el.innerHTML = x.responseText;
      }
    }

    x.open("GET", url + '&r=' + rdm(), true);
    x.send(null);
  }
}

function rdm() {
	return Math.floor(Math.random()*100000001);
}

function getOffsetTopList(el) {
	//el = document.getElementById(element);
	xPos = el.offsetTop;
	tempEl = el.offsetParent;
	while (tempEl != null) {
		xPos += tempEl.offsetTop;
		tempEl = tempEl.offsetParent;
	}
	return xPos;
}

function getOffsetLeftList(el) {
	//el = document.getElementById(element);
	xPos = el.offsetLeft;
	tempEl = el.offsetParent;
	while (tempEl != null) {
		xPos += tempEl.offsetLeft;
		tempEl = tempEl.offsetParent;
	}
	return xPos;
}

function listMOver(id) {
	var name = id.id;
	var img = window.frames['sh_product_list'].imgArray[name];
	var setX = getOffsetLeftList(document.getElementById('sh_product_list'));
	setX += document.getElementById('sh_product_list').offsetWidth;
	//setX += getOffsetLeftList(id);
	//setX += 25;
	
	var setY = getOffsetTopList(document.getElementById('sh_product_list'));
	//setY += getOffsetTopList(id);
	
	document.getElementById('lstShowImg').src = img;
	
	document.getElementById('lstPictureShow').style.top = setY + 'px';
	document.getElementById('lstPictureShow').style.left = setX + 'px';
	document.getElementById('lstPictureShow').style.display = 'block';
	//Effect.Appear('lstPictureShow', { duration: 0.3 });
}

function listMOut() {
	document.getElementById('lstPictureShow').style.display = 'none';
	//Effect.Fade('lstPictureShow', { duration: 0.3 });
}
