//************************************************************************//
//   QShop E-Commerce Solutions                                           //
//   Copyright @ VISUAL TECHNOLOGIES INC  2002-2007                       //
//   http://qshop.com.pl qshop@qshop.com.pl                               //
//************************************************************************//
//   This software is copyrighted, do not attempt to copy                 //
//   without permission                                                   //
//************************************************************************//
function set_pos(obj, whichedge){
	var edgeoffset=0
	if (whichedge=="rightedge"){
		var windowedge=document.all && !window.opera? avg().scrollLeft+avg().clientWidth-15 : window.pageXOffset+window.innerWidth-15
		m_ident.contentmeasure=m_ident.offsetWidth
		if (windowedge-m_ident.x < m_ident.contentmeasure)
		edgeoffset=m_ident.contentmeasure-obj.offsetWidth
	}
	else{
		var windowedge=document.all && !window.opera? avg().scrollTop+avg().clientHeight-15 : window.pageYOffset+window.innerHeight-18
		m_ident.contentmeasure=m_ident.offsetHeight
		if (windowedge-m_ident.y < m_ident.contentmeasure)
		edgeoffset=m_ident.contentmeasure+obj.offsetHeight
	}
	return edgeoffset
}
function avg(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function check_pos(what, pos_type){
	var totaloffset=(pos_type=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
	totaloffset=(pos_type=="left")? totaloffset : totaloffset+parentEl.offsetTop;
	parentEl=parentEl.offsetParent;
	}
	return totaloffset;
}
function out_main(e)
{
	delayhidemenu();
}
function show(obj,e,num_pod,menu) {
	restart();
	m_ident=GE(menu);
	hide_all();
	m_ident.onmouseout=delayhidemenu
	m_ident.onmouseover=clear_time
	m_ident.x=check_pos(obj, "left")
	m_ident.y=check_pos(obj, "top")
	m_ident.style.left=m_ident.x-set_pos(obj, "rightedge")+"px"
	m_ident.style.top=m_ident.y-9-set_pos(obj, "bottomedge")+obj.offsetHeight+"px"
	if(num_pod>0) { 
		GE(menu).style.visibility="visible";
	}
	e.onmouseover=clear_time();	
	GE(menu+'co').style.background='';
	GE(menu+'co').style.color=sp_menu_c15;
	GE(menu+'co').style.border='1px solid '+sp_menu_c13;
}
function showpodx()
{
	clear_time();
}
function restart()
{
	var allx=GE('sum_menu').value;
	for(i=1;i<=allx;i++) {
	GE('menu'+i+'co').style.background='';
	GE('menu'+i+'co').style.color=sp_menu_c16;
	GE('menu'+i+'co').style.border='1px solid '+sp_menu_c6;
	}
}
function hide() {
	var allx=GE('sum_menu').value;
	for(i=1;i<=allx;i++)
	{
		GE('menu'+i).style.visibility="hidden";
	}	
	restart();
}
function hidepod() {
	var allx=GE('sum').value;
	for(i=1;i<=allx;i++) {
		GE('podmenu'+i).style.visibility="hidden";
	}	
}
function showpod(obj,e,num_pod,podmenu){
	clear_time();
	hidepod();	
	if(num_pod>0) { 
		GE(podmenu).style.visibility="visible";
	}
}
function hide_all() {
	hidepod();
	hide();	
}
function delayhidemenu() {
	delayhide=setTimeout(hide_all,500)
}
function clear_time() {
	if (typeof delayhide!="undefined") {
		clearTimeout(delayhide)
	}
}
