
var oPopup;
var isexplorer;
/******* timers variables ******/
var currentsidr=0;
var currentsearch=0;
var currentdiagon=0;
var timer_id1=0
var timer_id2=0
var timer_id3=0
/*******************************/

function loadvars()
{

	isexplorer=getbrowser();
  if (isexplorer>5)	oPopup = window.createPopup();
//	loadimages();
}

function handcursor(obj)
{
	if (isexplorer>0) //enai IE
		obj.style.cursor='hand';
	else obj.style.cursor='pointer';
}

function showsection(pagename)		//for adults
{
 	if (isexplorer>0) // einai IE
 	{
	 	if (pagename=="eter")
	 	{
			eDIV3.style.visibility="visible";
		}
		else
	 	if (pagename=="prod")
	 	{
			pDIV3.style.visibility="visible";
		}
	}
}

function topbardisable(pagename)
{
 	if (isexplorer>0) // einai IE
 	{
	 	if (pagename=="eter")
	 	{
			eDIV1.replaceNode(eDIV3);
			eDIV3.style.visibility="visible";
		}
		else
	 	if (pagename=="prod")
	 	{
			pDIV1.replaceNode(pDIV3);
			pDIV3.style.visibility="visible";
		}
		else
	 	if (pagename=="cit")
	 	{
			cDIV1.replaceNode(cDIV3);
			cDIV3.style.visibility="visible";
		}
		else
	 	if (pagename=="mag")
	 	{
			mDIV1.replaceNode(mDIV3);
			mDIV3.style.visibility="visible";
		}
	}
}


function proddisable()
{
 	if (htmleidos_id.value=="101")
		book2_but.style.visibility="visible";
	else
 	if (htmleidos_id.value=="102")
		cdrom2_but.style.visibility="visible";
	else
 	if (htmleidos_id.value=="103")
		video2_but.style.visibility="visible";
	else
 	if (htmleidos_id.value=="104")
		ekped2_but.style.visibility="visible";
	else
 	if (htmleidos_id.value=="105")
		ilik2_but.style.visibility="visible";
 	if (htmleidos_id.value!="104" && htmleidos_id.value!="106" && htmleidos_id.value!="107" && document.URL.indexOf("productitem")!=-1)
 	{
	 	if (isexplorer>0)	//IE
			document.productform.elements['id_phoneorder'].style.visibility="visible";
		else //netscape
			id_phoneorder.style.visibility="visible";
	}
}

function magdisable()
{
 	if (htmleidos_id.value=="1")
 	{
		mag1h_but.style.visibility="visible";
		mag1_but.style.visibility="hidden";
	}
	else
 	if (htmleidos_id.value=="2")
 	{
		mag2h_but.style.visibility="visible";
		mag2_but.style.visibility="hidden";
	}
	else
 	if (htmleidos_id.value=="3")
		mag3h_but.style.visibility="visible";
	else
 	if (htmleidos_id.value=="4")
		mag4h_but.style.visibility="visible";
	else
 	if (htmleidos_id.value=="5")
 	{
		mag5h_but.style.visibility="visible";
		mag5_anim.style.cursor="auto";
	}
}

function compdisable()
{
 	if (htmleidos_id.value=="1")
		support2_but.style.visibility="visible";
 	else
 	if (htmleidos_id.value=="5")
		timokat2_but.style.visibility="visible";
}

function clubdisable()
{
 	if (htmleidos_id.value=="1")
		club1h_but.style.visibility="visible";
	else
 	if (htmleidos_id.value=="2")
		club2h_but.style.visibility="visible";
	else
 	if (htmleidos_id.value=="3")
		club3h_but.style.visibility="visible";
	else
 	if (htmleidos_id.value=="4")
		club4h_but.style.visibility="visible";
	else
 	if (htmleidos_id.value=="5")
		club5h_but.style.visibility="visible";
	else down_boy.style.visibility="hidden";
}

function sidromilabel()
{
	msidr_but.style.visibility="hidden";
	return;
 	if (htmlissidrom.value=="0")	//einai sidromitis
 		msidr_but.style.visibility="hidden";
 	else
 	if (htmlissidrom.value=="2")	//δεν είναι συνδρομητής
 	{
		msidr_but.style.background='url(images/magsidr_but.gif) no-repeat';
 		msidr_but.style.visibility="visible";
	}
 	else
 	if (htmlissidrom.value=="1")	//λήγει ή όπου ναναι λήγει
 	{
		msidr_but.style.background='url(images/maggsidr_but.gif) no-repeat';
 		msidr_but.style.visibility="visible";
	}
}

function helpme()
{
 	if (htmlhelp_id.value!="")
 	{
		var xpos=0;
		var ypos=0;
		var sfeatures="dialogWidth:650px;dialogHeight:500px;help:no;scroll:auto;status:no;center:off;dialogLeft:"+xpos+";dialogTop:"+ypos;
	 	if (isexplorer>0) // einai IE
			var iret=showModalDialog("help/"+htmlhelp_id.value,0,sfeatures);
		else window.open("help/"+htmlhelp_id.value,"_blank",sfeatures);
	}
}

function simbata(filenm)
{
	var xpos=0;
	var ypos=0;
	var sfeatures="dialogWidth:600px;dialogHeight:500px;help:no;scroll:auto;status:no;center:off;dialogLeft:"+xpos+";dialogTop:"+ypos;
 	if (isexplorer>0) // einai IE
		showModalDialog("help/"+filenm+".html",0,sfeatures);
	else window.open("help/"+filenm+".html","_blank",sfeatures);
}

function richToolTip(tip_id,width,high,yoffset)
{
  if (isexplorer>5)
	{
    var lefter = event.offsetY+yoffset;
    var topper = event.offsetX+40;
  	oPopup.document.body.innerHTML = tip_id.innerHTML;
    oPopup.show(topper, lefter, width,high, tip_id);
	}
}

function richToolTiphide()
{
	if (isexplorer>5) oPopup.hide();
}

function anazitisi(path,tipos,isadult)
{
	var sfeatures;
	var cSearchValue;
	var xpos;
	var ypos;

	xpos=window.screenLeft+document.all.seDIV1.offsetLeft+document.all.seDIV1.clientWidth-300;
	if (tipos==0) ypos=window.screenTop+document.all.seDIV1.offsetTop;
	else ypos=window.screenTop+100+document.all.smsearchbutton.offsetTop;
	sfeatures="dialogWidth:300px;dialogHeight:151px;help:no;scroll:no;status:no;center:off;dialogLeft:"+xpos+";dialogTop:"+ypos;
	if (tipos==0)
	{
	  if (isexplorer<0)
	  {
			if (isadult==0) window.open(path+"search.html","_self");
			else window.open(path+"searchad.html","_self");
			return;
		}
		else
		{
			if (isadult==0)	cSearchValue=showModalDialog(path+"search.html",0,sfeatures);
			else cSearchValue=showModalDialog(path+"searchad.html",0,sfeatures);
		}
	}
	else
	{
	  if (isexplorer<0)
	  {
			window.open(path+"searchcitydesk.html?"+htmlforum_id.value,"_self");
			return;
		}
		else
		{
			var forumobject = new Object();
			forumobject.forum_id = htmlforum_id.value;
			cSearchValue=showModalDialog(path+"searchcitydesk.html",forumobject,sfeatures);
		}
	}
	if (cSearchValue != null)
	{
		if (cSearchValue.substr(0,1)!='&')
		{
			if (isadult==0) window.open(path+"results.aspx?ss="+cSearchValue,"_self");
			else window.open(path+"resultsad.aspx?ss="+cSearchValue,"_self");
		}
	}
}

function imagepopup(imagepath,w,h)
{
	var sfeatures;
	sfeatures="dialogWidth:"+w+"px;dialogHeight:"+h+"px;help:no;scroll:auto;status:no;center:on";
	var pathobject = new Object();
	pathobject.imagepath = imagepath;
 	if (isexplorer>0) // einai IE
		showModalDialog("imagepopup.html",pathobject,sfeatures);
	else window.open("imagepopup.html?"+imagepath,"_blank",sfeatures);
}

function videopopup(imagepath,w,h,version)
{
	var sfeatures;
	sfeatures="dialogWidth:"+w+"px;dialogHeight:"+h+"px;help:no;scroll:auto;status:no;center:on";
	var pathobject = new Object();
	pathobject.imagepath = imagepath;
	if (version==6)
		pathobject.playerclass ="22D6F312-B0F6-11D0-94AB-0080C74C7E95";	//6.0
	else pathobject.playerclass ="6BF52A52-394A-11d3-B153-00C04F79FAA6";		//10
 	if (isexplorer>0) // einai IE
		showModalDialog("videos.html",pathobject,sfeatures);
	else alert(ie_id.value);
}

function loopOnce(sndobj)
{
  sndobj.loop = 1;
  sndobj.volume=0;
  sndobj.src = sndobj.src; // reload sound
}

function changelangpage(lang)
{
	var s=document.URL;
	s=s.toLowerCase();
	if (lang=='e')
	{
		if (s.indexOf("greek")>0)
			s=s.replace("greek","english");
	}
	else
	if (lang=='g')
	{
		if (s.indexOf("english")>0)
			s=s.replace("english","greek");
	}
	navigate(s);
}


/******************************* timers *************************/

function startsidrtimer(msec)
{
	if (timer_id1==0)
		timer_id1=setInterval('cyclesidrom(msidr_but)',msec);
}

function clearsidrtimer()
{
	clearInterval(timer_id1);
	timer_id1=0;
}

function cyclesidrom(layer)
{
 	if (currentsidr==0)
  {
	 	if (htmlissidrom.value=="2")			//Δεν έχει συνδρομή
			layer.style.background='url(images/magsidrh_but.gif) no-repeat';
 		else
 		if (htmlissidrom.value=="1")	//λήγει ή όπου ναναι λήγει
			layer.style.background='url(images/maggsidrh_but.gif) no-repeat';
		currentsidr=1;
  }
  else
  {
	 	if (htmlissidrom.value=="2")			//Δεν έχει συνδρομή
			layer.style.background='url(images/magsidr_but.gif) no-repeat';
 		else
 		if (htmlissidrom.value=="1")	//λήγει ή όπου ναναι λήγει
			layer.style.background='url(images/maggsidr_but.gif) no-repeat';
		currentsidr=0;
  }
}
/******/

function startsearchtimer(msec,rootd)
{
	if (timer_id2==0)
	{
		if (rootd==1) timer_id2=setInterval('cyclesearch1(seDIV1)',msec);
		else timer_id2=setInterval('cyclesearch(seDIV1)',msec);
	}
}

function clearsearchtimer()
{
	clearInterval(timer_id2);
	timer_id2=0;
}

function cyclesearch(layer)
{
 	if (currentsearch==0)
  {
		layer.style.background='url(images/search2_button.jpg) no-repeat';
		currentsearch=1;
  }
  else
  {
		layer.style.background='url(images/search1_button.jpg) no-repeat';
		currentsearch=0;
  }
}

function cyclesearch1(layer)
{
 	if (currentsearch==0)
  {
		layer.style.background='url(greek/images/search2_button.jpg) no-repeat';
		currentsearch=1;
  }
  else
  {
		layer.style.background='url(greek/images/search1_button.jpg) no-repeat';
		currentsearch=0;
  }
}

/******/

function startmaintimer(msec,layer,pich,pic)
{
	var s='cyclemaintimer('+layer+',"'+pich+'","'+pic+'")';
	if (timer_id1==0)
		timer_id1=setInterval(s,msec);
}

function clearmaintimer()
{
	clearInterval(timer_id1);
	timer_id1=0;
}

function cyclemaintimer(layer,pich,pic)
{
 	if (currentdiagon==0)
  {
		var s='url('+pich+') no-repeat';
		layer.style.background=s;
		currentdiagon=1;
  }
  else
  {
		var s='url('+pic+') no-repeat';
		layer.style.background=s;
		currentdiagon=0;
  }
}


function emailus()
{
	window.open('mailto:erevnite@otenet.gr','_self');
}

function forgotuser()
{
	var sfeatures;
	sfeatures="dialogWidth:400px;dialogHeight:260px;help:no;scroll:no;status:no;center:on";
	showModalDialog("sendpassword.html",0,sfeatures);
}
