	function categoryOver(imenu) {
		if(imenu==6) { location.href='index.php?page=content&cat=1527'; return; }
			var newsubmenu;
			newsubmenu=parseInt(imenu);
			if(currsubmenu>=0 && currsubmenu!=newsubmenu)	{
				document.getElementById('asubmenu'+currsubmenu).style.display='none';
				//currsubmenu=-1;
			} 
			//if(newsubmenu>=0) {
				if(document.getElementById('asubmenu'+newsubmenu).style.display=='none' || document.getElementById('asubmenu'+newsubmenu).style.display=='') document.getElementById('asubmenu'+newsubmenu).style.display='block'; else  document.getElementById('asubmenu'+newsubmenu).style.display='none';
				currsubmenu=newsubmenu;
		//}
			document.getElementById('asubmenu'+newsubmenu).style.left=(newsubmenu*109-6)+'px';
	}
	
	function mouseX(e) {
		if(e) return e.clientX;
		else if(window.event) return window.event.pageX+document.body.scrollLeft;
		else return 0;
	}
	function mouseY(e) {
		var posy = 0;
		if (!e) var e = window.event;
		if (e.pageY) 	{
			posy = e.pageY;
		} else if (e.clientY) 	{
			posy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
		}		
		return posy;
	}	
	function showProductInfo(x,e) {
		var lo=document.getElementById('page-box').offsetLeft;
		if(document.getElementById('productinfo_iframe')) {
			document.getElementById('productinfo_iframe').src='index.php?page=productframe&pid='+x;
			document.getElementById('productinfo').style.display='block';
			document.getElementById('productinfo').style.left=(lo+100)+'px';
			document.getElementById('productinfo').style.top=(mouseY(e))+'px';
		}
	}
	
	function switchWlArrow() {
		if(document.images["wlarrow"].src.substr(-5)!='2.gif') document.images["wlarrow"].src='images/arrow-white2.gif';
		else document.images["wlarrow"].src='images/arrow-white.gif';
	}
	
	var lm_lev,lm_cid;	
	function showleftmenu(lev,cid) {
		if(lm_lev>0 && lm_cid>0 && document.getElementById('cat'+lm_lev+'_'+lm_cid)) {
			document.getElementById('cat'+lm_lev+'_'+lm_cid).style.display='none';
			if(lm_lev>1) document.getElementById('cat'+lm_lev+'_'+lm_cid).parentNode.parentNode.style.display='none';
		}
		if(document.getElementById('cat'+lev+'_'+cid)) {
			document.getElementById('cat'+lev+'_'+cid).style.display='block';
			if(lev>1) document.getElementById('cat'+lev+'_'+cid).parentNode.parentNode.style.display='block';
		}
		lm_lev=lev;
		lm_cid=cid;
	}

	function hidealltabs() {
		var i,t,l;
		for(i=1; i<=4; i++) {
			t='ptab_'+i;
			l='ltab_'+i;
			if(document.getElementById(t)) {
				document.getElementById(t).style.display='none';
				document.getElementById(l).className='';
			}
		}
	}
	function showproducttab(itab) {
		var t,l;
		hidealltabs();
		t='ptab_'+itab; 
		l='ltab_'+itab;
		if(document.getElementById(t)) {
			document.getElementById(t).style.display='block';
			document.getElementById(l).className='active';
		}		
	}

	function showBasketContents(scr,pid) {
		a = new sack();
		a.setVar('id',pid);
		a.requestFile = 'x_showbasket.php?r='+Math.random();
		a.onCompletion = function(){ 
				if(document.getElementById('basket_contents_div')) d=document.getElementById('basket_contents_div');
				else if(parent.document.getElementById('basket_contents_div')) d=parent.document.getElementById('basket_contents_div');
				else d='';
					if(d) {
						d.innerHTML=a.response; 
						if(!scr) d.scrollIntoView();
					}
			}
		a.runAJAX();		
	}
	
	function add2basket(pid) {
		add2basket2(pid,'1');
	}
	function add2basket2(pid,q) {	
		a = new sack();
		a.requestFile = 'x_add2basket.php?r='+Math.random();
  	a.setVar('id',pid);
  	a.setVar('act','add');
  	a.setVar('q',q);
		a.onCompletion = function(){ if(a.response=='OK') { 
				alert('Το προϊόν προστέθηκε!'); 
				showBasketContents(false,pid);
				//animatecartitem();
			} else alert(a.response); }
		a.runAJAX();				
	}
	function updatebasketitem(pid) {
		var q=0;
		if(document.getElementById('bq_'+pid)) 	q=document.getElementById('bq_'+pid).value;
		if(q<=0) alert('Λάθος ποσότητα!'); else location.href='x_updatebasket.php?pid='+pid+'&q='+q;
	}
	
	var animb;
	function animatecartitem() {
		o=document.getElementById('justincart');
		if(o) { 
			animb=100;
			o.style.borderSize='1px';
			setTimeout('changeborder(o)',10);
		}
	}
	function genHex(){
		var colors,color,digit;
		colors = new Array(14);
		colors[0]="0";
		colors[1]="1";
		colors[2]="2";
		colors[3]="3";
		colors[4]="4";
		colors[5]="5";
		colors[5]="6";
		colors[6]="7";
		colors[7]="8";
		colors[8]="9";
		colors[9]="a";
		colors[10]="b";
		colors[11]="c";
		colors[12]="d";
		colors[13]="e";
		colors[14]="f";
		
		digit = new Array(5);
		color="#";
		for (i=0;i<6;i++){
			digit[i]=colors[Math.round(Math.random()*14)];
			color = color+digit[i];
		}
		return color;
	}	
	function changeborder(o) {
		animb--;
		o.style.backgroundColor=genHex()+' !important';
		if(animb>0) setTimeout('changeborder(o)',50);
	}
	

