var $$=YAHOO.util.Dom.get,Connect=YAHOO.util.Connect,Dom=YAHOO.util.Dom,Event=YAHOO.util.Event,JSON=YAHOO.lang.JSON,Anim=YAHOO.util.Anim,Easing=YAHOO.util.Easing;function trim(a){for(;a.substring(0,1)==" ";)a=a.substring(1,a.length);for(;a.substring(a.length-1,a.length)==" ";)a=a.substring(0,a.length-1);return a}String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.ltrim=function(){return this.replace(/^\s+/,"")};
String.prototype.rtrim=function(){return this.replace(/\s+$/,"")};function left(a,c){return c<=0?"":c>String(a).length?a:String(a).substring(0,c)}String.prototype.left=function(a){var c=this;if(c!=null)c=a<=0?"":a>String(x).length?c:String(c).substring(0,a);return c};function right(a,c){if(c<=0)return"";else if(c>String(a).length)return a;else{var d=String(a).length;return String(a).substring(d,d-c)}}
String.prototype.right=function(a){var c=this;if(c!=null)if(a<=0)c="";else if(a>String(x).length)c=c;else{var d=String(c).length;c=String(c).substring(d,d-a)}return c};function txtClearOnClick(a,c){if(c[0]=="focus"){if($$(c[1]).value==c[2]){$$(c[1]).value="";$$(c[1]).style.color="#000"}}else if($$(c[1]).value==""){$$(c[1]).value=c[2];$$(c[1]).style.color="#999"}}
function textAreaMaxLength(a){var c=a.getAttribute?parseInt(a.getAttribute("maxlength")):"";if(a.getAttribute&&a.value.length>c)a.value=a.value.substring(0,c)}function cookieRead(a){a=a+"=";for(var c=document.cookie.split(";"),d=0;d<c.length;d++){for(var g=c[d];g.charAt(0)==" ";)g=g.substring(1,g.length);if(g.indexOf(a)==0)return g.substring(a.length,g.length)}return null}
function cookieSet(a,c,d){if(d){var g=new Date;g.setTime(g.getTime()+d*24*60*60*1E3);d="; expires="+g.toGMTString()}else d="";document.cookie=a+"="+c+d+"; path=/"}function chkAll(a){for(var c=$$(a.target).getElementsByTagName("input"),d=0;d<c.length;d++)if(c[d].type=="checkbox")c[d].checked=$$(a.parent).checked}
function chkGetCheckedLst(a){var c="";a=$$(a.divContainer).getElementsByTagName("input");for(var d=0;d<a.length;d++)if(a[d].type=="checkbox")if(a[d].checked&&a[d].value!="on")c+=a[d].value+",";return c}var gaJsHost="https:"==document.location.protocol?"https://ssl.":"http://www.";document.write(unescape("%3Cscript src='"+gaJsHost+"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));function cboGeo(a,c,d,g){function p(b){if(b){if(b.countrylbl)$$(o.lblid).innerHTML=b.countrylbl;if(b.regionlbl)$$(l.lblid).innerHTML=b.regionlbl;if(b.deptlbl)$$(k.lblid).innerHTML=b.deptlbl;if(b.citylbl)$$(j.lblid).innerHTML=b.citylbl;if(b.countryid)$$(o.cboid).innerHTML=b.countrycbo;if(b.regioncbo)$$(l.cboid).innerHTML=b.regioncbo;if(b.deptbo)$$(k.cboid).innerHTML=b.deptcbo;if(b.citycbo)$$(j.cboid).innerHTML=b.citycbo;if(b.getdeptcities)F=b.getdeptcities;if(b.loadcbo)h=b.loadcbo;if(b.countryisos)B=
b.countryisos;if(!G){setTimeout(function(){r()},250);G=true}}}function t(){var b=0;try{b=Number($$(o.cboid).options[$$(o.cboid).selectedIndex].value)}catch(e){}var f=0;try{f=Number($$(l.cboid).options[$$(l.cboid).selectedIndex].value)}catch(s){}var m=0;try{m=Number($$(k.cboid).options[$$(k.cboid).selectedIndex].value)}catch(y){}var u=0;try{u=Number($$(j.cboid).options[$$(j.cboid).selectedIndex].value)}catch(M){}return{countryid:b,regionid:f,deptid:m,cityid:u}}function v(){var b="";try{b=$$(o.cboid).options[$$(o.cboid).selectedIndex].innerHTML}catch(e){}var f=
"";try{f=$$(l.cboid).options[$$(l.cboid).selectedIndex].innerHTML}catch(s){}var m="";try{m=$$(k.cboid).options[$$(k.cboid).selectedIndex].innerHTML}catch(y){}var u="";try{u=$$(j.cboid).options[$$(j.cboid).selectedIndex].innerHTML}catch(M){}return{countryvalue:b,regionvalue:f,deptvalue:m,cityvalue:u}}function r(){N()}function N(){var b={};b.action="getCountryList";if(B)b.countryisos=B;b="obj="+JSON.stringify(b);Connect.asyncRequest("POST","/include/ajax/geoData.php",{success:O},b)}function H(b){var e=
{};e.action="getRegionList";e.countryid=b;b="obj="+JSON.stringify(e);Connect.asyncRequest("POST","/include/ajax/geoData.php",{success:P},b)}function I(b){var e={};e.action="getDeptList";e.regionid=b;b="obj="+JSON.stringify(e);Connect.asyncRequest("POST","/include/ajax/geoData.php",{success:Q},b)}function z(b,e){var f={};f.action="getCityList";if(b)f.regionid=b;else if(e)f.deptid=e;b="obj="+JSON.stringify(f);Connect.asyncRequest("POST","/include/ajax/geoData.php",{success:R},b)}function O(b){if(b=
JSON.parse(b.responseText)){$$(o.cboid).innerHTML="";$$(l.cboid).innerHTML="";$$(k.cboid).innerHTML="";$$(j.cboid).innerHTML="";n($$(l.cboid));n($$(k.cboid));n($$(j.cboid));for(var e=q(null,"","-"),f=0;f<b.length;f++)e=q(e,b[f].id,b[f].txt,h&&h.countryid==b[f].id);$$(o.cboid).appendChild(e);Event.removeListener(o.cboid,"change",J);Event.on(o.cboid,"change",J,null,this);h&&h.countryid&&h.regionid!=null&&H(h.countryid)}}function J(b,e){if(b=YAHOO.util.Event.getTarget(b)){h=null;b=Number(b.options[b.selectedIndex].value);
if(b!=0){n($$(l.cboid));H(b)}else{n($$(l.cboid));n($$(k.cboid));n($$(j.cboid))}}}function P(b){if(b=JSON.parse(b.responseText)){$$(l.cboid).innerHTML="";$$(k.cboid).innerHTML="";$$(j.cboid).innerHTML="";n($$(k.cboid));n($$(j.cboid));for(var e=q(null,"","-"),f=0;f<b.length;f++)e=q(e,b[f].id,b[f].txt,h&&h.regionid==b[f].id);$$(l.cboid).appendChild(e);Event.removeListener(l.cboid,"change",K);Event.on(l.cboid,"change",K,null,this);C($$(l.cboid));if(h&&h.countryid==74)h.regionid&&h.deptid!=null&&I(h.regionid);
else h&&h.regionid&&h.cityid!=null&&z(h.regionid,null)}}function K(b,e){if(b=YAHOO.util.Event.getTarget(b)){b=Number(b.options[b.selectedIndex].value);if(b!=0)t().countryid==74?I(b):z(b,null);else{n($$(k.cboid));n($$(j.cboid))}}}function Q(b){if(b=JSON.parse(b.responseText)){$$(k.cboid).innerHTML="";$$(j.cboid).innerHTML="";n($$(j.cboid));for(var e=q(null,"","-"),f=0;f<b.length;f++)e=q(e,b[f].id,b[f].txt,h&&h.deptid==b[f].id);$$(k.cboid).appendChild(e);C($$(k.cboid));if(F){Event.removeListener(k.cboid,
"change",L);Event.on(k.cboid,"change",L,null,this);h&&h.deptid!=null&&h.cityid!=null&&z(null,h.deptid)}}}function L(b,e){if(b=YAHOO.util.Event.getTarget(b)){b=Number(b.options[b.selectedIndex].value);b!=0?z(null,b):n($$(j.cboid))}}function R(b){if(b=JSON.parse(b.responseText)){$$(j.cboid).innerHTML="";for(var e=q(null,"","-"),f=0;f<b.length;f++)e=q(e,b[f].id,b[f].txt,h&&h.cityid==b[f].id);$$(j.cboid).appendChild(e);C($$(j.cboid))}}function n(b){Dom.removeClass(b.parentNode,D);Dom.addClass(b.parentNode,
w)}function C(b){Dom.removeClass(b.parentNode,w);Dom.addClass(b.parentNode,D)}function A(b,e,f,s){var m=document.createElement("div");m.id="div"+f.substr(0,1).toUpperCase()+f.substr(1);var y=document.createElement("label");y.id=e;m.appendChild(y);e=document.createElement("select");e.id=f;m.appendChild(e);Dom.addClass(m,s);b.appendChild(m)}function q(b,e,f,s){b||(b=document.createDocumentFragment());var m=document.createElement("option");m.value=e;m.innerHTML=f;if(s)m.selected=s;b.appendChild(m);return b}
function S(b,e){return Math.round(Math.random()*e)+b}if(d==null)d="none";if(g==null)g="block";this.initConfig=p;this.initGeoData=r;this.getSelectedIds=t;this.getSelectedValues=v;var E=null,w=d,D=g,F=false,G=false,o={lblid:"lblCountry"+c,cboid:"cboCountry"+c},l={lblid:"lblRegion"+c,cboid:"cboRegion"+c},k={lblid:"lblDept"+c,cboid:"cboDept"+c},j={lblid:"lblCity"+c,cboid:"cboCity"+c},h=null,B=null;if($$(a)){c=document.createDocumentFragment();A(c,o.lblid,o.cboid,D);A(c,l.lblid,l.cboid,w);A(c,k.lblid,
k.cboid,w);A(c,j.lblid,j.cboid,w);E=a;$$(E).innerHTML="";$$(E).appendChild(c);p({countrylbl:"Pays :",regionlbl:"R\u00e9gion :",deptlbl:"D\u00e9partement :",citylbl:"Ville :",getdeptcities:false,countryisos:["FR","CA","BE","CH","LU"]})}};var msgBoxObj=null;
function msgBox(a,c,d,g,p){if(d==null)d="";if(g==null)g="";if(p==null)p=500;a=(Dom.getClientWidth()-p)/2;if(d=="yesno")var t=document.body.scrollTop+75;else{t=75;document.body.scrollTop=0}if(d==""){$$("msgBoxObjIcon").style.display="none";if(YAHOO.env.ua.ie==0)$$("msgBoxObjLbl").style.width=p*0.95}else{$$("msgBoxObjIcon").style.display="block";$$("msgBoxObjIcon").src="/img/ic/"+d+".png";if(YAHOO.env.ua.ie==0)$$("msgBoxObjLbl").style.width=400}$$("msgBoxObjLbl").innerHTML=c;Dom.setStyle($$("msgBoxObj"),"display",
"block");Dom.setStyle($$("msgBoxObj"),"width",p+"px");if(msgBoxObj==null)msgBoxObj=new YAHOO.widget.Dialog("msgBoxObj",{xy:[a,t],underlay:"none",modal:true,close:true,draggable:false,visible:false,zindex:10});msgBoxObj.cfg.queueProperty("buttons",d==""?[]:d=="yesno"?[{text:'<img src="/img/cmd/yes.png" class="cmd" />',handler:{fn:function(v,r){msgBoxObj.cancel();eval(g)},obj:null},isDefault:true},{text:'<img src="/img/cmd/no.png" class="cmd" />',handler:{fn:function(v,r){msgBoxObj.cancel()},obj:null},
isDefault:true}]:g!=""?[{text:'<img src="/img/cmd/ok.png" class="cmd" />',handler:{fn:function(v,r){msgBoxObj.cancel();eval(g)},obj:null},isDefault:true}]:[{text:'<img src="/img/cmd/ok.png" class="cmd" />',handler:{fn:function(v,r){msgBoxObj.cancel()},obj:null},isDefault:true}]);msgBoxObj.render();msgBoxObj.show();$$("focusCatcher").focus()}
function disableSelection(a){if(typeof a.onselectstart!="undefined")a.onselectstart=function(){return false};else if(typeof a.style.MozUserSelect!="undefined")a.style.MozUserSelect="none";else a.onmousedown=function(){return false};a.style.cursor="default"}function popupCgu(){Connect.asyncRequest("GET","/include/ajax/cgu.php",{success:function(a){msgBox("",a.responseText,"","",775);disableSelection($$("msgBoxObj"))}})};function cmdLogin(a,c){Event.preventDefault(a);var d={};d.action="login";d.method=c==1?"facebook":"";d.uname=$$("txtLoginUname").value;d.pwd=$$("txtLoginPwd").value;a="obj="+encodeURIComponent(JSON.stringify(d));Connect.asyncRequest("POST","/include/ajax/login.php",{success:function(g){g=JSON.parse(g.responseText);if(g.result=="1")document.location.href=domainLogin+"/site.php";else if(d.method=="facebook")document.location.href="/facebook.php";else UI.MsgBoxHP({msgType:"datamsg",msg:g.result,iconType:"error"})}},
a)}function cmdLostPwd(){var a={};a.action="lostPwd";a.email=$$("txtLostEmail").value;a="obj="+encodeURIComponent(JSON.stringify(a));Connect.asyncRequest("POST","/include/ajax/index.php",{success:function(c){c=JSON.parse(c.responseText);UI.MsgBoxHP({msgType:"datamsg",msg:c.result,iconType:"success"})}},a)}function toggleLoginLostPwd(a,c){$$("loginFrm").style.display=a;$$("lostPwdFrm").style.display=c}
function displayErrorLoc(a,c){a=Dom.getRegion(a);if(a.top>0){$$(c).style.top=a.top+"px";$$(c).style.left=a.left+200+"px"}else $$(c).style.display="none"}
function displayError(a,c){errField="err"+right(a,a.length-3);if(c==null)$$(errField).style.display="none";else{if(a=="txtUname"||a=="txtPwd"||a=="chkTos")$$(errField).innerHTML='<div class="errTxt">'+c+"</div>";else $$(errField).innerHTML='<div class="errCbo">'+c+"</div>";if(a=="cboRegion"||a=="cboDept"||a=="cboCity"){a=a.replace("cbo","divCbo");if($$(a).className!="none")$$(errField).style.display="block"}else $$(errField).style.display="block";if(a=="cboDDN")a="cboDay";if(a=="cboCountry")displayErrorLoc("cboCountry",
errField);else if(a=="divCboRegion")displayErrorLoc("cboRegion",errField);else if(a=="divCboDept")displayErrorLoc("cboDept",errField);else if(a=="divCboCity")displayErrorLoc("cboCity",errField);else{c=Dom.getRegion(a);if(a=="chkTos")$$(errField).style.left=c.left+335+"px";else $$(errField).style.left=c.left+200+"px"}}}
function validateFields(a){var c="";a=Event.getTarget(a);if(a.id=="cmdRegister")c=[["cboSexSeeking",$$("cboSexSeeking").value,""],["txtUname",$$("txtUname").value,""],["txtPwd",$$("txtPwd").value,""],["txtEmail",$$("txtEmail").value,""],["cboDDN",$$("cboDay").value+"-"+$$("cboMonth").value+"-"+$$("cboYear").value,""],["chkTos",$$("chkTos").checked,""],["cboCountry",$$("cboCountry").value,""],["cboRegion",$$("cboRegion").value,""],["cboDept",$$("cboDept").value,""],["cboCity",$$("cboCity").value,""]];
else if(a.id=="cboDay"||a.id=="cboMonth"||a.id=="cboYear")displayError("errDDN");else if(a.id=="cboCountry"||a.id=="cboRegion"&&$$("divCboRegion").className!="none"||a.id=="cboDept"&&$$("divCboDept").className!="none"||a.id=="cboCity"&&$$("divCboCity").className!="none"||a.id=="chkTos")displayError(a.id);else c=a.id=="txtUname"||a.id=="txtPwd"?[[a.id,[$$("txtUname").value,$$("txtPwd").value],""]]:[[a.id,$$(a.id).value,""]];if(c!=""){var d={};d.action="valid";d.fields=c;d.senderId=a.id;c="obj="+encodeURIComponent(JSON.stringify(d));
Connect.asyncRequest("POST","/include/ajax/registration.php",{success:function(g){g=JSON.parse(g.responseText);if(g==1)document.location.href=domainLogin+"/site.php?reg=1";else for(i=0;i<g.length;i++)displayError(g[i][0],g[i][2])}},c)}}
function pageLoadBoth(){(new cboGeo("cboGeoReg","","none","block cb mb")).initConfig({loadcbo:{countryid:cboGeoV.countryid,regionid:cboGeoV.regionid,deptid:cboGeoV.deptid,cityid:cboGeoV.cityid}});Event.addListener("cmdRegister","click",validateFields,"");Event.addListener("txtUname","blur",validateFields,"");Event.addListener("txtPwd","blur",validateFields,"");Event.addListener("cboDay","change",validateFields,"");Event.addListener("cboMonth","change",validateFields,"");Event.addListener("cboYear",
"change",validateFields,"");Event.addListener("cboCountry","change",validateFields,"");Event.addListener("cboRegion","change",validateFields,"");Event.addListener("cboDept","change",validateFields,"");Event.addListener("cboCity","change",validateFields,"");Event.addListener("chkTos","click",validateFields,"");_gat._getTracker("UA-15395189-1")._trackPageview()}
function pageLoadHp(){var a=screen.width/screen.height<1.34?"back4x3":"back16x9";a+=$$("hidBack").value;if($$("hidPid").value!="1007"){$$("bg").innerHTML='<img src="/img/hp/'+a+'.jpg" width="100%">';if(screen.width==320&&(screen.height==396||screen.height==480))$$("lnk").style.display="none";else if(screen.width==1024&&screen.height==600)$$("lnk").style.top="630px";else $$("lnk").style.top=screen.height-78+"px"}a=Dom.getRegion("regForm");$$("regFormPuck").style.top=a.top-56+"px";$$("regFormPuck").style.left=
a.left+66+200+"px";$$("regFormPuck").style.display="block";a=screen.width;var c=screen.height;if(a>1E3){$$("regFormGuarantee").style.top=c-325+"px";$$("regFormGuarantee").style.left=a-400+"px";$$("regFormGuarantee").style.display="block"}Event.addListener("txtEmail","blur",validateFields,"");Event.addListener("cmdLogin","click",cmdLogin,"");Event.addListener("txtLoginUname","focus",txtClearOnClick,["focus","txtLoginUname",Const.Txts.txtLoginUname]);Event.addListener("txtLoginUname","blur",txtClearOnClick,
["blur","txtLoginUname",Const.Txts.txtLoginUname]);(new YAHOO.util.KeyListener(["txtLoginUname","txtLoginPwd"],{keys:13},cmdLogin)).enable();pageLoadBoth()}function pageLoadFacebook(){pageLoadBoth()}function disableSelect(a){if(typeof a.onselectstart!="undefined")a.onselectstart=function(){return false};else if(typeof a.style.MozUserSelect!="undefined")a.style.MozUserSelect="none";else a.onmousedown=function(){return false};a.style.cursor="default"}YAHOO.namespace("UI");var UI=YAHOO.UI;
UI.MsgBoxHP=function(a){if(typeof a=="string")a={msgType:a};a="obj="+JSON.stringify(a);Connect.asyncRequest("POST","/include/ajax/popupMsgData.php",{success:function(c){if(c=JSON.parse(c.responseText)){var d=$("#MsgBox").overlay({api:true});if(d){d.close();$("#MsgBox").remove()}$(document.body).append(c.msgbody);$("#MsgBox").overlay(c.ovlcfgs);disableSelect($$("MsgBox"))}}},a)};

