function swapLanguage(d){var c=location.toString();if(c.toLowerCase().indexOf("/"+info.lang+"/")>-1){var b=new RegExp("/"+info.lang+"/","i");var a=c.replace(b,"/"+d+"/");window.open(a,"_self")}else{window.open(c.replace(".html","/"+d+"/index.html"),"_self")}}function RedirectHome(){location="/"}function removeClass(b,a){$(b).removeClassName(a)}function addClass(b,a){$(b).addClassName(a)}function isEmpty(a){return $(a).value.blank()}function getY(b){var a=0;while(b!=null){a+=b.offsetTop;b=b.offsetParent}return a}function getX(b){var a=0;while(b!=null){a+=b.offsetLeft;b=b.offsetParent}return a}function getXY(a){var c=0;var b=0;while(a!=null){c+=a.offsetLeft;b+=a.offsetTop;a=a.offsetParent}return{left:c,top:b}}var ScrollLightBox=true;var LightBoxOnHidden=null;function displayLightBox(k,h,b,m,i){if(b==null||b<300){b=300}if(m!=null){ScrollLightBox=m}else{ScrollLightBox=true}LightBoxOnHidden=i;var a=document;var l=Math.max(Math.max(a.body.scrollHeight,a.documentElement.scrollHeight),Math.max(a.body.offsetHeight,a.documentElement.offsetHeight),Math.max(a.body.clientHeight,a.documentElement.clientHeight));var d=Math.max(Math.max(a.body.scrollWidth,a.documentElement.scrollWidth),Math.max(a.body.offsetWidth,a.documentElement.offsetWidth),Math.max(a.body.clientWidth,a.documentElement.clientWidth));var c=0;var j=0;if(typeof window.innerWidth!="undefined"){c=window.innerHeight;j=window.innerWidth}else{if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!=0){c=document.documentElement.clientHeight;j=document.documentElement.clientWidth}else{c=document.getElementsByTagName("body")[0].clientHeight;j=document.getElementsByTagName("body")[0].clientWidth}}if((l-c)<=4){l=c}var f=$("lightBoxBackground");f.style.top="0px";f.style.left="0px";f.style.height=l+"px";f.style.width=j+"px";f.style.overflow="hidden";f.style.display="block";var g=$("lightBox_iframeBg");g.style.top=0;g.style.left=0;g.style.height=l;g.style.width=d;$("lightbox_title").innerHTML=k;$("lightbox_innerContent").innerHTML=h;$("LightBox_Content").style.width=b+"px";CenterObject($("LightBox_Content"));$("LightBox_Content").style.display="block";$("LightBoxcloseBox").style.display="block"}Event.observe(window,"load",function(a){if($("LightBox_Content")!=null){Event.observe(window,"resize",function(b){if($("LightBox_Content").style.display!=""){bDragingLayer=false;CenterObject($("LightBox_Content"))}});Event.observe(window,"scroll",function(b){if($("LightBox_Content").style.display!=""&&ScrollLightBox){bDragingLayer=false;CenterObject($("LightBox_Content"))}})}});function hiddenLightBox(){if(LightBoxOnHidden!=null){if(LightBoxOnHidden()){LightBoxOnHidden=null;$("LightBox_Content").style.display="none";$("lightBoxBackground").style.display="none"}}else{$("LightBox_Content").style.display="none";$("lightBoxBackground").style.display="none"}}function CenterObject(i){var b=document.viewport.getScrollOffsets();var d=0;var g=0;if(typeof window.innerWidth!="undefined"){d=window.innerHeight;g=window.innerWidth}else{if(typeof document.documentElement!="undefined"&&typeof document.documentElement.clientWidth!="undefined"&&document.documentElement.clientWidth!=0){d=document.documentElement.clientHeight;g=document.documentElement.clientWidth}else{d=document.getElementsByTagName("body")[0].clientHeight;g=document.getElementsByTagName("body")[0].clientWidth}}var c=$(i).getHeight();var f=$(i).getWidth();var a=0;if(c<d){a=(d-c)/2}var h=0;if(f<g){h=(g-f)/2}$(i).setStyle({top:(a+b.top)+"px"});$(i).setStyle({left:h+"px"});if(c>d){$("lightbox_innerContent").setStyle({height:(d-100)+"px"});$("lightbox_innerContent").setStyle({overflowY:"auto"})}else{$("lightbox_innerContent").setStyle({height:"auto"});$("lightbox_innerContent").setStyle({overflowY:"auto"})}$(i).style.zIndex=1000}function Login(a){if(a==null){a=false}var c='<center><table wdith="145" border="0" class="LoginLightBox">';c+='<tr><td class="redirection">Redirection</td><td><select id="redirection" class="redirection_input">';for(var b=0;b<info.redirection.length;b++){c+='<option value="'+info.redirection[b].link+'">'+info.redirection[b].name+"</option>"}c+="</select></td></tr>";c+='<tr><td class="username">Login Name</td><td><input type="text" onkeypress="checkBtn2(event,13) && $(\'UserPassword\').focus();"  id="UserName" class="username_input"/></td></tr>';c+='<tr><td class="password">Password</td><td><input type="password" onkeypress="checkBtn2(event,13) && loginCheck();" id="UserPassword" class="password_input"/></td></tr>';c+='<tr><td></td><td class="forgotPassword"><a class="forgetpwd" href="/'+info.lang+'/forgetPassword.html">Forget Password?</a></td></tr>';c+='<tr><td class="loginError" id="LoginErrorMessage" colspan="2">&nbsp;</td></tr>';c+='<tr><td colspan="2"><div class="registerNow">Not yet our registered visitor?<br />';c+='<a href="javascript:Register()">Register NOW</a></div>';c+='<div onclick="loginCheck()" class="loginbtn">Login</div></td></tr>';c+="</table></center>";displayLightBox("User Login",c);$("UserName").focus();if(a){$("LightBoxcloseBox").style.display="none"}}function Register(){window.location="/"+info.lang+"/VisitorRegistration.html"}var bDragingLayer=false;var pLeft,pTop,dragX,dragY;var currLayer=null;function startDragLayer(a,c,b){currLayer=document.getElementById(a);bDragingLayer=true;pLeft=parseInt(currLayer.style.left);pTop=parseInt(currLayer.style.top);dragX=c;dragY=b}Event.observe(window,"load",function(b){Event.observe(document,"mouseup",function(c){bDragingLayer=false});Event.observe(document,"mousemove",processMouseMoveEvent);if($("lightBox_iframeBg")!=null){var a=$("lightBox_iframeBg").contentWindow||oIframe.contentDocument;if(a.document){a=a.document}if(a){Event.observe(a,"mouseup",function(c){bDragingLayer=false});Event.observe(a,"mousemove",processMouseMoveEvent);Event.observe(a,"click",hiddenLightBox)}}$$("[truncateContent]").each(function(f){var d=f.readAttribute("truncateContent");var c=f.readAttribute("truncateSize");if(c==null){c=200}else{c=parseInt(c)}f.innerHTML=TruncateString(d,c,f.readAttribute("ellipses"))})});function processMouseMoveEvent(a){e=a;if(bDragingLayer){if(currLayer!=null){var c=pLeft+e.clientX-dragX;var b=pTop+e.clientY-dragY;currLayer.style.left=c+"px";currLayer.style.top=b+"px"}}}function mainPosition(a){var b=$("MainMenu");if(b==null){return}b.childElements().each(function(d){var c=d.getElementsByTagName("div");if(c.length>0){c[0].style.left=getX(d)+"px";c[0].style.top=(getY(d)+29)+"px"}})}Event.observe(window,"load",function(a){var b=$("MainMenu");if(b==null){return}b.childElements().each(function(d){var c=d.getElementsByTagName("div");if(c.length>0){c[0].style.left=getX(d)+"px";c[0].style.top=(getY(d)+29)+"px";Event.observe(d,"mouseover",function(f){if(d.readAttribute("timeout")!=null&&d.readAttribute("timeout")!="f"){clearInterval(d.readAttribute("timeout"));d.setAttribute("timeout","f")}c[0].style.display="block"});Event.observe(d,"mouseout",function(f){d.setAttribute("timeout",setInterval(function(){c[0].style.display="none"},300))})}})});Event.observe(window,"resize",mainPosition);function ReplaceParam(g,f,a){var d=getQueryVariable();if(f==null){d.unset(g)}else{d.set(g,f)}if(a!=null&&a.length!=null){for(var c=0;c<a.length;c+=2){if(a[c+1]==null){d.unset(a[c])}else{d.set(a[c],a[c+1])}}}var b=d.toQueryString();if(b[0]=="&"){b=b.substring(1)}location=location.pathname+"?"+b+location.hash}function ReplacePath(j,a){var f=getQueryVariable();var d=new Hash();for(var c=0;c<a.length;c++){var g=f.get(a[c]);if(g!=null){d.set(a[c],g)}}var b=d.toQueryString();if(b[0]=="&"){b=b.substring(1)}location=j+"?"+b+location.hash}function getQueryVariable(){var c=window.location.search.substring(1);var d=c.split("&");var a=new Hash();for(var b=0;b<d.length;b++){var f=d[b].split("=");a.set(f[0],f[1])}return a}function Logout(){new Ajax.Request("/service/Logout.html",{method:"post",onSuccess:function(a){location.href=location.pathname+location.search}})}function loginCheck(){var a=$("redirection").value;cusloginCheck("UserName","UserPassword",a,"LoginErrorMessage",function(b){location.replace(b)});return false}function cusloginCheck(h,b,a,d,g){var h=$(h).value;var c=$(b).value;var f;if(h.blank()||c.blank()){f=JsLabel["js.Login.PleaseFillUserNamePassword"];if(f==null){f="Error"}if(d!=null){$(d).innerHTML=f}else{alert(f)}$(b).focus();return}new Ajax.Request("/service/Login.html",{method:"post",parameters:{strLoginID:h,strPassword:c},onSuccess:function(l){var j=l.responseText;try{var i=j.evalJSON(true);if(i.Status=="success"){if(g!=null){g(a)}else{location.replace(a)}}else{f=JsLabel["js.Login.PASSWORD_NOT_MATCH"];if(f==null){f="Error"}if(d!=null){$(d).innerHTML=f}else{alert(f)}$(b).focus()}}catch(k){}}})}function checkBtn2(b,a){var c=0;if(window.event){c=b.keyCode}else{if(b.which){c=b.which}}if(c==a){return true}return false}function ReloadPage(){location.href=location.pathname+location.search}function AddToFavourite(){var c=document.title;var a="FashionNetAsia.com";if(c!=null){a=c}if(window.sidebar){window.sidebar.addPanel(a,location.href,"")}else{if(window.external){try{window.external.AddFavorite(location.href,a)}catch(b){alert("Please press Ctrl + D in order to Add Bookmarks")}}else{alert("Please press Ctrl + D in order to Add Bookmarks")}}}function TruncateString(o,q,b){var a=0;var g="";var l;var m=new Array();for(l=0;l<o.length;){var n=o.charAt(l);if(n=="<"){var f=1;var d=1;var p="";while((l+f)<o.length&&o.charAt(l+f)!=">"){f++}p=o.substring(l+1,l+f);if(p[0]=="/"){var h=p.substring(1);if(p.indexOf(" ")>-1){h=p.substring(1,p.indexOf(" "))}if(m[m.length-1]==h){m.pop()}else{alert("html syntax error")}}else{if(p.charAt(p.length-1)=="/"){}else{var h=p;if(p.indexOf(" ")>-1){h=p.substring(0,p.indexOf(" "))}m.push(h)}}l=l+f+1}else{a++;l++}if(a>=q){break}}html=o.substring(0,l);if(a>=q&&b!=null){html+=b}while(m.length>0){html+="</"+m.pop()+">"}return html}function changeEdit(a){$("edit_type").value=a;if(a=="password"){removeClass("profile_edit_link","edit_profile_on");addClass("profile_edit_link","edit_profile_off");removeClass("password_edit_link","edit_profile_off");addClass("password_edit_link","edit_profile_on");$("edit_profile_div").style.display="none";$("edit_password_div").style.display="block"}else{if(a=="profile"){removeClass("profile_edit_link","edit_profile_off");addClass("profile_edit_link","edit_profile_on");removeClass("password_edit_link","edit_profile_on");addClass("password_edit_link","edit_profile_off");$("edit_profile_div").style.display="block";$("edit_password_div").style.display="none"}}}function savePassword(){var a=$("old_password").value;var f=$("new_password").value;var d=$("renew_password").value;var c=$("please_input_password").value;var b=$("repassword_not_correct").value;if(a!=""&&f!=""&&d!=""){if(f!=d){alert(b)}else{$("register_form").submit()}}else{alert(c)}}function saveProfile(){var a=$("register_form");if(validation(a)){a.submit();return true}else{}};

Event.observe(window, 'load', function(e){
	var menus = $$(".menu");
	if(menus.length > 0){
		menus[0].select("a").each(function (o){
			o.observe('mouseover', function(ee){
				o.writeAttribute('out', o.style.backgroundImage);
				o.style.backgroundImage = "url("+o.readAttribute("hover")+")";
			});
			o.observe('mouseout', function(ee){
				o.style.backgroundImage = o.readAttribute("out");
			});
		});
	}
});
function UpdateBreadcrumb(a){b=$("BreadCrumb");var c=b.select("a");c[c.length-1].innerHTML=a.escapeHTML()}
function AddBreadcrumb(a){b=$("BreadCrumb");b.innerHTML+='&nbsp;>&nbsp;'+a+""}

function Blog_NewProcess(){

	getTextareaEditorHTML('content');
	$('contentSub').value = TruncateString($('content').value, 200, "...");
	if(validation($('blognewform'))){
		return true;
	}else{
		return false;
	}
}
