function ltrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}

function trim(str, chars) {
return ltrim(rtrim(str, chars), chars);
}
function VALID_STRING(STR_PARAM) {
var CL_STRING = trim(STR_PARAM);
if (CL_STRING.length == '0') {
return false;	
} else {
return true;
}	
}

function changeLoc(newloc) {
 location.replace(newloc);
}

function VALITATEFORM(form,lang) {
	name = form.name.value;
	phone = form.phone.value;
	if (name == '') {
		if (lang == 'gr') {
			alert("Παρακαλώ εισάγετε το ονομά σας");
		} else if (lang == 'en') {
			alert("Please enter your name");
		}
		return false;
	} else if (phone == '') {
		if (lang == 'gr') {
			alert("Παρακαλώ εισάγετε το τηλεφωνό σας");
		} else if (lang == 'en') {
			alert("Please enter your phone number");
		}
		return false;
	} else {
		return true;
	}
}

function SHOW_R() {
	var R_NUM = document.getElementById("resrv_rooms_no").value;
	for(var r=1;r<=4;r++) {
		if (r<=R_NUM) {
			document.getElementById("ROOM_"+r).style.display = "block";
		} else {
			document.getElementById("ROOM_"+r).style.display = "none";
		}
	}
}

function mm_over(id, PAR_1, PAR_4, PAR_2) { 

	var COUNT_AR = PAR_4.split("|");
	var i;
	for(i=0; i<COUNT_AR.length; i++) {
		if (PAR_1 == COUNT_AR[i]) {
			document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'block'; 
		} else {
			document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'none'; 
		}
	}
}
function mm_out(id, PAR_1, PAR_4, PAR_2) { 
	/*var COUNT_AR = PAR_4.split("|");
	var i;
	for(i=0; i<COUNT_AR.length; i++) {
		if (PAR_2 == COUNT_AR[i]) {
			document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'block'; 
		} else {
			document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'none'; 
		}
	}*/
}


function TD_BGCOLOR(CASE, PAR_1, PAR_2, ROOT_PAR_1, PAR_4) {

	var COUNT_AR = PAR_4.split("|");
	var i;
	if (CASE == '1') { //over
		for(i=0; i<COUNT_AR.length; i++) {
			if (PAR_1 == COUNT_AR[i]) {
			  if ((COUNT_AR[i] != PAR_2)&&(COUNT_AR[i] != ROOT_PAR_1)) {
				//document.getElementById('mm_'+COUNT_AR[i]).style.backgroundColor = 'FFFFFF';
			  } 
			  document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'block'; 
			} else {
			  if ((COUNT_AR[i] != PAR_2)&&(COUNT_AR[i] != ROOT_PAR_1)) {
				//document.getElementById('mm_'+COUNT_AR[i]).style.backgroundColor = 'FFFFFF';
			  } 
			  document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'none'; 
			}
		}
	} 
}

function TD_SUBMENU(PAR_1, PAR_2, PAR_3, PAR_4, CASE, event) {
	
	var COUNT_AR = PAR_4.split("|");
	var i;
	var toElement = null;

	if (event.relatedTarget) {
		toElement = event.relatedTarget;
	} else if (event.toElement) {
		toElement = event.toElement;
	}
	
	while (toElement && toElement.id != 'sub_of_'+PAR_1) {
		toElement = toElement.parentNode;
	}

	if (!toElement) {
		if (document.getElementById) {
		//if (!event.fromElement.contains(event.toElement) &&!document.getElementById('sub_of_'+PAR_1).contains(event.toElement)) {	
			if ((PAR_1 != PAR_2)&&(PAR_1 != PAR_3)) {
				//document.getElementById('mm_'+PAR_1).style.backgroundColor = 'FFFFFF';
			}
			for(i=0; i<COUNT_AR.length; i++) {
				if ((PAR_2 == COUNT_AR[i])||(PAR_3 == COUNT_AR[i])) {
					document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'block';//'none'; 
				} else {
					document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'none'; 
				}
			}
		//}
		}
	}
}

function TD_SUBMENU_SINGLE(PAR_2, PAR_3, PAR_4, event) {
	
	var COUNT_AR = PAR_4.split("|");
	var i;
	var toElement = null;

	if (event.relatedTarget) {
		toElement = event.relatedTarget;
	} else if (event.toElement) {
		toElement = event.toElement;
	}
	
	while (toElement && toElement.id != 'under_mm') {
		toElement = toElement.parentNode;
	}

	if (!toElement) {
		if (document.getElementById) {
		//if (!event.fromElement.contains(event.toElement) &&!document.getElementById('sub_of_'+PAR_1).contains(event.toElement)) {	
			/*if ((PAR_1 != PAR_2)&&(PAR_1 != PAR_3)) {
				document.getElementById('mm_'+PAR_1).style.backgroundColor = 'FFFFFF';
			}*/
			for(i=0; i<COUNT_AR.length; i++) {
				if ((PAR_2 == COUNT_AR[i])||(PAR_3 == COUNT_AR[i])) {
					document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'block';//'none'; 
				} else {
					document.getElementById('sub_of_'+COUNT_AR[i]).style.display = 'none'; 
					//document.getElementById('mm_'+COUNT_AR[i]).style.backgroundColor = 'FFFFFF';
				}
			}
		//}
		}
	}
}

function POPUPWindow(PAGE,TITLE,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

    window.POPUP_WINDOW = open(PAGE, 'POPUP_WINDOW', 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
	
}

function M_POPUP(FILE,w,h){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

    window.POPUP_WINDOW = open('../web_images/menu_images/'+FILE, 'PHOTO_POPUP', 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars=no,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no');
	
}







//for stroke

function processTextStroke(selector){
  var v=getElementsBySelector(selector);
  for(i=0;i < v.length;i++){
    processElement(v[i]);
  }
}

function processElement(v){
  var content=v.innerHTML;
  for (j=1;j<=8;j++){
    var d=document.createElement("span");
    d.className = "stroke"+j;
    d.innerHTML = content;
    v.appendChild(d);
  }
  v.removeChild(v.firstChild);
  var dd=document.createElement("span");
  dd.className = "rawtext";
  dd.innerHTML = content;
  v.appendChild(dd);
}
  
function NiftyCheck(){
  if(!document.getElementById || !document.createElement)
    return(false);
  var b=navigator.userAgent.toLowerCase();
  if(b.indexOf("msie 5")>0 && b.indexOf("opera")==-1)
    return(false);
  return(true);
}
////
function getElementsBySelector(selector){
  var i;
  var s=[];
  var selid="";
  var selclass="";
  var tag=selector;
  var objlist=[];
  if(selector.indexOf(" ")>0){  //descendant selector like "tag#id tag"
    s=selector.split(" ");
    var fs=s[0].split("#");
    if(fs.length==1) return(objlist);
    return(document.getElementById(fs[1]).getElementsByTagName(s[1]));
  }
  if(selector.indexOf("#")>0){ //id selector like "tag#id"
    s=selector.split("#");
    tag=s[0];
    selid=s[1];
  }
  if(selid!=""){
    objlist.push(document.getElementById(selid));
    return(objlist);
  }
  if(selector.indexOf(".")>0){  //class selector like "tag.class"
    s=selector.split(".");
    tag=s[0];
    selclass=s[1];
  }
  var v=document.getElementsByTagName(tag);  // tag selector like "tag"
  if(selclass=="")
    return(v);
  for(i=0;i < v.length;i++){
    if(v[i].className==selclass){
      objlist.push(v[i]);
    }
  }
  return(objlist);
}

function NL_PR_PGALLERY (SRC, CONT, IMG_W){
	if (document.getElementById){
        var c = document.getElementById(CONT);
        if (c.style.display != "block"){
			ADD_IMG_W = "";
			if (parseInt(IMG_W) > 534) {
				ADD_IMG_W  = ' width="534"';
			}
            c.innerHTML = '<img src="' + SRC + '"'+ADD_IMG_W+'>';
        }
		else {
            c.style.display="none";
        }
    }
}

function POPUPWindow_RESIZABLE(PAGE,TITLE,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

    window.POPUP_WINDOW = open(PAGE, 'POPUP_WINDOW', 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes');
	
}

function POPUPWindow_RESIZABLE_2(PAGE,TITLE,w,h,scroll){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;

    window.POPUP_WINDOW_W = open(PAGE, 'POPUP_WINDOW_W', 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes');
	
}

function Filter_Recs(REC_ID) {
	
	var SEL_FLT_ = document.getElementById("s_cat");
	SEL_FLT_ = SEL_FLT_.options[SEL_FLT_.selectedIndex].value;

	LOC_RPL = "index.php?action=1&rec="+REC_ID;
	if (SEL_FLT_ != "") {
	  LOC_RPL += "&s_cat="+SEL_FLT_;
	}
	changeLoc(LOC_RPL);

}

function Filter_Recs_2(REC_ID) {
	
	var SEL_CC_ = document.getElementById("s_cc");
	SEL_CC_ = SEL_CC_.options[SEL_CC_.selectedIndex].value;

	LOC_RPL = "index.php?action=1&rec="+REC_ID;
	if (SEL_CC_ != "") {
	  LOC_RPL += "&s_cc="+SEL_CC_;
	}
	changeLoc(LOC_RPL);

}
function CHECK_SEARCH_FORM(form, LANG) {return true;}

function TMPL_TABS(S_TAB) {
if (S_TAB == '1') { 
document.getElementById("MODEL_INFO").style.display = "block";
document.getElementById("GALLERY_INFO").style.display = "none";
} else {
document.getElementById("MODEL_INFO").style.display = "none";
document.getElementById("GALLERY_INFO").style.display = "block";
}
}

if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){if(!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;},getSWFHTML:function(){var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();return true;
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){
return false;
}return true;};
deconcept.util={getRequestParameter:function(_29){
var q=document.location.search||document.location.hash;
if(q){var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all){return;}
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){_2d[i].style.display="none";for(var x in _2d[i]){
if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};
deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};
__flash_savedUnloadHandler=function(){};
if(typeof window.onunload=="function"){
var _30=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();_30();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}};
if(typeof window.onbeforeunload=="function"){
var oldBeforeUnload=window.onbeforeunload;
window.onbeforeunload=function(){
deconcept.SWFObjectUtil.prepUnload();
oldBeforeUnload();};
}else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;}
if(Array.prototype.push==null){
Array.prototype.push=function(_31){
this[this.length]=_31;
return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject;
var SWFObject=deconcept.SWFObject;
