﻿var aj = new GLM.AJAX();

function onmenu(lev, obj, on, childID, tableID)
{
	var tID = "mChild"+tableID;

	if(lev == 0)
	{
		if(on == 0)
		{
			if(obj.getAttribute("sel") == 0)
				obj.className = "menutable0";
		}	
		else
		{
			obj.className = "menutable0on";
			
			var trs = document.getElementsByTagName('table');
			for(i=0;i<trs.length;i++)
			{
				try
				{
					if(trs[i].getAttribute("type") == "submenu")
						trs[i].className = "subMenuTable";
				}
				catch(e){}
			}
			
			if(childID == -1)
				return;
			
			document.getElementById(tID).className = "subMenuTableON";			
		}	
	}
	else
	{
		if(on == 0)
		{
			if(obj.getAttribute("sel") == 0)
				obj.className = "menutable1";
		}	
		else
		{
			obj.className = "menutable1on";			
		}	
	}
}

function showThis(id)
{
	document.getElementById(id).className="subMenuTableON";
}

function park()
{
	var sec  = document.getElementById("theSec").value;
	var want  = document.getElementById("hiddenWant").value;
	var msg  = document.getElementById("theMes").value;
	
	if(sec == "")
	{
		alert("Πρέπει να εισάγετε τους χαρακτήρες που βλέπετε στην εικόνα");
		return;
	}
	res = aj.callPage("index.php", getSec, "POST", "id=SEC");
	if(res != sec)
	{
		alert("Έχετε εισάγει λάθος τους χαρακτήρες της εικόνας.");
		return;
	}
	res = aj.callPage("index.php", getPRK, "POST", "id=PRKQ&want="+want+"&msg="+msg);
	alert(res);
}

function getPRK()
{
}

function contactForm()
{
	var mail = document.getElementById("theEmail").value;
	var mes  = document.getElementById("theMes").value;
	var sec  = document.getElementById("theSec").value;
	var name  = document.getElementById("yourname").value;
	
	if(mail == "" || mes== "" || sec == "")
	{
		alert("Ολα τα πεδία που συνοδεύονται από * είναι υποχρεωτικά");
		return;
	}
	
	res = aj.callPage("index.php", getSec, "POST", "id=SEC");
	if(res != sec)
	{
		alert("Έχετε εισάγει λάθος τους χαρακτήρες της εικόνας.");
		return;
	}
	
	res = aj.callPage("index.php", getSec, "POST", "id=CSN&mail="+mail+"&mes="+mes+"&name="+name);
	alert(res);
}

function getSec(response)
{

}

function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {//alert(document);
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
			//var imgUsemap = (img.usemap)?" usemap='" + img.usemap + "'":"";  
			//alert(img.usemap);
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\');\"></span>" 
            img.outerHTML = strNewHTML;
            i = i-1;
			//if(imgName == "FOOTERCORNERLEFT.PNG")
				//alert(strNewHTML);
         }
      }
   }    
}
