// JScript source code
function CallBackObject()
{
  this.XmlHttp = this.GetHttpObject();
}
 
CallBackObject.prototype.GetHttpObject = function()
{ 
   var xmlhttp;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
      alert(e);
    }
  }
  return xmlhttp;
}

CallBackObject.prototype.DoCallBack = function(thePage,eventTarget, eventArgument)
{
  if( this.XmlHttp )
  {
    if( this.XmlHttp.readyState == 4 || this.XmlHttp.readyState == 0 )
    {
      var oThis = this;
      this.XmlHttp.open('GET', thePage, true); 
     // alert(thePage);
      this.XmlHttp.onreadystatechange = function(){ oThis.ReadyStateChange(); };
      this.XmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      this.XmlHttp.send(null); 
    }
  }
}
 
CallBackObject.prototype.AbortCallBack = function()
{
  if( this.XmlHttp )
    this.XmlHttp.abort();
}
 
CallBackObject.prototype.OnLoading = function()
{
  // Loading
}
 
CallBackObject.prototype.OnLoaded = function()
{
  // Loaded
}
 
CallBackObject.prototype.OnInteractive = function()
{
  // Interactive
}
 
CallBackObject.prototype.OnComplete = function(responseText, responseXml)
{
  // Complete
}
 
CallBackObject.prototype.OnAbort = function()
{
  // Abort
}
 
CallBackObject.prototype.OnError = function(status, statusText)
{
  // Error
}
 
CallBackObject.prototype.ReadyStateChange = function()
{
  if( this.XmlHttp.readyState == 1 )
  {
    this.OnLoading();
  }
  else if( this.XmlHttp.readyState == 2 )
  {
    this.OnLoaded();
  }
  else if( this.XmlHttp.readyState == 3 )
  {
    this.OnInteractive();
  }
  else if( this.XmlHttp.readyState == 4 )
  {
    if( this.XmlHttp.status == 0 )
      this.OnAbort();
    else if( this.XmlHttp.status == 200 && this.XmlHttp.statusText == "OK" )
      this.OnComplete(this.XmlHttp.responseText, this.XmlHttp.responseXML);
    else
      this.OnError(this.XmlHttp.status, this.XmlHttp.statusText, this.XmlHttp.responseText);   
  }
}

function GetContent(marker,the_page)
{ 
	var url=the_page;
	var Cbo = new CallBackObject();
	var content=""; 	
 
    //content = "<img src='site_images/load.gif' width='10px' height='10px' > Loading Please Wait ...";//+url;
 
	Cbo.OnComplete = Cbo_Complete;
	Cbo.OnError    = Cbo_Error;  
    Cbo.DoCallBack(url,'elementID', '');

	function Cbo_Complete(responseText, responseXML)
	{
		if( responseText != "" )
		{
			content = responseText;
			marker.openInfoWindowTabsHtml([new GInfoWindowTab("Info", content)]);
		}
		else
		{
			content = 'unavailable...';
			marker.openInfoWindowTabsHtml([new GInfoWindowTab("Info", content)]);
		}
	}

	function Cbo_Error(status, statusText, responseText)
	{
		content = responseText;
		marker.openInfoWindowTabsHtml([new GInfoWindowTab("Info", content)]);
	}
}

function LoadPage(elementID,the_page)
{ 
	var url=the_page;
	var Cbo = new CallBackObject();
	var loader = gel('loader');
	//alert(the_page);
	
	loader.innerHTML = "<img src='site_images/load.gif' width='10px' height='10px' > Loading Please Wait ...";//+url;
 
	Cbo.OnComplete = Cbo_Complete;
	Cbo.OnError    = Cbo_Error;  
    Cbo.DoCallBack(url,'elementID', '');
    
	function Cbo_Complete(responseText, responseXML)
	{
		if( responseText != "" )
		{
			gel(elementID).innerHTML = responseText;
			//UpdateFocus(elementID);
			loader.innerHTML = '';
		}
		else
		{
			loader.innerHTML = 'unavailable...';
			//loader.innerHTML.style.color = 'red';
		}
	}

	function Cbo_Error(status, statusText, responseText)
	{
		loader.style.color = 'red';
		loader.innerHTML="Error Loading ..."
		gel(elementID).innerHTML = responseText;
	}
}

function LoadMyPage(elementID,the_page)
{ 
	var url=the_page;
	var Cbo = new CallBackObject();
	var loader = gel(elementID);
	if(gel(elementID).innerHTML!="")
	{
		he(elementID);
		gel(elementID).innerHTML=""; 
		return;
	}
	else
	{
		se(elementID);
	}
	
	loader.innerHTML = "<img src='site_images/load.gif' width='10px' height='10px' >Φόρτωση Σελίδας ...";//+url;
 
	Cbo.OnComplete = Cbo_Complete;
	Cbo.OnError    = Cbo_Error;  
    Cbo.DoCallBack(url,'elementID', '');
    
	function Cbo_Complete(responseText, responseXML)
	{
		if( responseText != "" )
		{
			gel(elementID).innerHTML = responseText;
			//UpdateFocus(elementID);
			loader.innerHTML = '';
		}
		else
		{
			loader.innerHTML = 'unavailable...';
			//loader.innerHTML.style.color = 'red';
		}
	}

	function Cbo_Error(status, statusText, responseText)
	{
		loader.style.color = 'red';
		loader.innerHTML="Error Loading ..."
		gel(elementID).innerHTML = responseText;
	}
}

function LoadList(elementID,page,cid)
{ 
	var Cbo = new CallBackObject();
	var url = page+"?cid="+cid+"&eid="+elementID;
	//alert(url);
	Cbo.OnComplete = Cbo_Complete;
	Cbo.OnError    = Cbo_Error;
	
	var loader = gel(elementID);
	loader.innerHTML="";
	var style= "BORDER-LEFT-COLOR: dimgray; BORDER-BOTTOM-COLOR: dimgray; TEXT-TRANSFORM: uppercase; WIDTH: 175px; BORDER-TOP-STYLE: solid; BORDER-TOP-COLOR: dimgray; BORDER-RIGHT-STYLE: solid; BORDER-LEFT-STYLE: solid; HEIGHT: 19px; BACKGROUND-COLOR: #1f1f1f; BORDER-RIGHT-COLOR: dimgray; BORDER-BOTTOM-STYLE: solid";
   // var style = "WIDTH: 175px"; 
	loader.innerHTML ="<SELECT class='combo' style='"+style+" COLOR: #ccccff'><OPTION> Loading ..</OPTION></SELECT>";
	Cbo.DoCallBack(url,'elementID', '');
	
	function Cbo_Complete(responseText, responseXML)
	{
		if( responseText != "" )
		{
			loader.innerHTML=responseText; 
			loader.style.color = 'green';
		}
		else
		{
			loader.innerHTML = 'unavailable...';
			loader.style.color = 'red';
		}
	}

	function Cbo_Error(status, statusText, responseText)
	{
		loader.style.color = 'red';
		loader.innerHTML = "<SELECT class='combo' style='"+style+"'><OPTION> error_loading ..</OPTION></SELECT>";
	}
}

function ToHtml(inputString)
{
	var encodedInputString=escape(inputString);
	encodedInputString=encodedInputString.replace("++", "%2B%2B");
	encodedInputString=encodedInputString.replace("+", "%2B");
	encodedInputString=encodedInputString.replace("/", "%2F");     
	return  encodedInputString;  
}

function ToText(inputString)
{
	//var inputString=document.forms["TestEncodingForm"]["inputString"].value;
	var encodedInputString=unescape(inputString);
	encodedInputString=encodedInputString.replace("%2B", "+");
	encodedInputString=encodedInputString.replace("%2F", "/");     
	return  encodedInputString;  
	//document.forms["TestEncodingForm"]["encodedInputString"].value=encodedInputString;
}

function IsNumeric(sText)
{
   var ValidChars = "0123456789.";
   var IsNumber=true;
   var Char;

   for (i = 0; i < sText.length && IsNumber == true; i++) { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1){
         IsNumber = false;
      }
   }
   return IsNumber;
}

function gel(el)
{
	return document.getElementById(el);
}

function trim(inputString) 
{
   if (typeof inputString != "string") { return inputString; }
   var retValue = inputString;
   var ch = retValue.substring(0, 1);
   while (ch == " ") { 
      retValue = retValue.substring(1, retValue.length);
      ch = retValue.substring(0, 1);
   }
   ch = retValue.substring(retValue.length-1, retValue.length);
   while (ch == " ") { 
      retValue = retValue.substring(0, retValue.length-1);
      ch = retValue.substring(retValue.length-1, retValue.length);
   }
   while (retValue.indexOf("  ") != -1) { 
      retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); 
   }
   return retValue; 
} 


function se(elementID) 
{
	if (document.layers)
		document.layers[elementID].display="inline";
	else 
		document.all[elementID].style.display="inline";
}

function he(elementID) 
{
	if (document.layers)
		document.layers[elementID].display="none";
	else 
		document.all[elementID].style.display="none";
}

function chi(c1,c2)
{
	if(gel(c2).selectedIndex <= gel(c1).selectedIndex) 
		gel(c2).selectedIndex = gel(c1).selectedIndex;
}

function $(s) {return document.getElementById(s);}

function p(str, ctrl) {
	i=0;m=$(ctrl);
	var l = str.split("|");
	var ic = false;
	m.options[i++]=new Option('Ολα','-1');
	for (x in l)
	{
		d = l[x].split(',');
		if (d[1] == null) 
		{
			ic = false;
			continue;
		}
		if (ic)d[1] ='\xa0\xa0\xa0' + d[1];
		if (d[0].substr(0,1) == 'c')
		ic = true;
		m.options[i++] =
		new Option(d[1], d[0]);	}
		//m.options[i++]=new Option('Αλλο','0');
}

function ChangeCat(c1,c2)
{
	x=$(c2);
	for(var i=x.options.length;i>=0;i--)
	{	
		x.options[i]=null;
	}
	x.selectedIndex=-1;
	p(models[$(c1).value],c2);
}

function SetCity()
{ 
    var a = $("city_select"); 
    var b = $("h_city");   
    b.value =  a.options[a.selectedIndex].value; 
}

function ho(o)
{ 
    if(o.value=="email" || o.value=="password") o.value = "";  
}

