/**
 * @author HKM
 * @date 2010/7/8
 * @version 0.1.3.3 beta
 * @copyright: axicy.com All rights reserved
 */
function search_focus(OJ){if(OJ.value==OJ.defaultValue)OJ.value="";OJ.className="scol_focus";}function search_blur(OJ){if(OJ.value=="")OJ.value=OJ.defaultValue;if(OJ.value==OJ.defaultValue)OJ.className="scol_blur";}var search_hexClr=/^([\s]{0,})(color|colour)([\s]{0,1}):([\s]{0,1})(#([0-9a-f]{3}|[0-9a-f]{6}))([\s]{0,})(;err([\s]{0,2}):([\s]{0,2})[0-9]{1,2}){0,1}$/i;var search_decClr=/^([\s]{0,})(color|colour)([\s]{0,1}):([\s]{0,1})rgb([\s]{0,1})\(([\s]{0,})([0-9]{1,3})([\s]{0,}),([\s]{0,})([0-9]{1,3})([\s]{0,}),([\s]{0,})([0-9]{1,3})([\s]{0,})\)([\s]{0,})(;err([\s]{0,2}):([\s]{0,2})[0-9]{1,2}){0,1}$/i;var search_hsvClr=/^([\s]{0,})(color|colour)([\s]{0,1}):([\s]{0,1})hsv([\s]{0,1})\(([\s]{0,})([0-9]{1,3})([\s]{0,}),([\s]{0,})([0-9]{1,3})([\s]{0,}),([\s]{0,})([0-9]{1,3})([\s]{0,})\)([\s]{0,})(;err([\s]{0,2}):([\s]{0,2})[0-9]{1,2}){0,1}$/i;var search_hClr=/^([\s]{0,})(color|colour)([\s]{0,1}):([\s]{0,1})h([\s]{0,1})\(([\s]{0,})([0-9]{1,3})([\s]{0,})\)([\s]{0,})(;err:[0-9]{1,2}){0,1}$/i;function search_change(){var search_OJ=document.forms['search'].q;var clr_showOJ=document.getElementById("clr_shower");var strSpl;if(clr_showOJ&&search_OJ){if(strSpl=search_hexClr.exec(search_OJ.value)){if(clr_showOJ.className=="clr_picker")clr_showOJ.className="clr_shower";clr_showOJ.style.backgroundColor="#"+strSpl[6];}else if(strSpl=search_decClr.exec(search_OJ.value)){if(clr_showOJ.className=="clr_picker")clr_showOJ.className="clr_shower";if(strSpl[7]>255)strSpl[7]=255;if(strSpl[10]>255)strSpl[10]=255;if(strSpl[13]>255)strSpl[13]=255;clr_showOJ.style.backgroundColor="rgb("+strSpl[7]+","+strSpl[10]+","+strSpl[13]+")";}else if(strSpl=search_hsvClr.exec(search_OJ.value)){if(clr_showOJ.className=="clr_picker")clr_showOJ.className="clr_shower";if(strSpl[7]>360)strSpl[7]=360;if(strSpl[10]>100)strSpl[10]=100;if(strSpl[13]>100)strSpl[13]=100;var tRGB=clr_hsvrgb(strSpl[7],strSpl[10],strSpl[13]);clr_showOJ.style.backgroundColor="rgb("+tRGB.r+","+tRGB.g+","+tRGB.b+")";}else if(strSpl=search_hClr.exec(search_OJ.value)){if(clr_showOJ.className=="clr_picker")clr_showOJ.className="clr_shower";if(strSpl[7]>360)strSpl[7]=360;var tRGB=clr_hsvrgb(strSpl[7],100,100);clr_showOJ.style.backgroundColor="rgb("+tRGB.r+","+tRGB.g+","+tRGB.b+")";}else if(clr_showOJ.className=="clr_shower"){clr_showOJ.className="clr_picker";clr_showOJ.style.backgroundColor="transparent";}}}function search_submit(OJ){if(OJ['q']){if(OJ['q'].value!=""&&OJ['q'].value!=OJ['q'].defaultValue)return true;}return false;}var gaJsHost,pageTracker,gaLoadInti;gaLoadInti=true;var noLoadGA=new Array("/setting.php");function loadGA(){for(var i=0;i<noLoadGA.length;i++){if(window.location.href.indexOf(noLoadGA[i])!=-1)return;}gaJsHost=(("https:"==document.location.protocol)?"https://ssl.":"http://www.");var jsLoad=document.createElement("script");jsLoad.src=gaJsHost+"google-analytics.com/ga.js";jsLoad.type="text/javascript";jsLoad.onload=finshGA;jsLoad.onreadystatechange=finshGA;document.body.appendChild(jsLoad);}var GA_ID=new Array("UA-12640670-1","UA-12640670-2","UA-12640670-3","UA-12640670-4");var site_GA_ID;function finshGA(){if(gaLoadInti){try{if(location.hostname=="hk.axicy.com")site_GA_ID=1;else if(location.hostname=="en.axicy.com")site_GA_ID=2;else if(location.hostname=="cn.axicy.com")site_GA_ID=3;else site_GA_ID=0;pageTracker=_gat._getTracker(GA_ID[site_GA_ID]);pageTracker._trackPageview();gaLoadInti=false;}catch(err){};}}if(window.addEventListener){window.addEventListener("load",search_change,false);}else if(window.attachEvent){window.attachEvent("onload",search_change);}if(location.href.indexOf("axicy.com")!=-1){if(window.addEventListener){window.addEventListener("load",loadGA,false);}else if(window.attachEvent){window.attachEvent('onload',loadGA);}}var mouseCod={x:0,y:0};var clr_rgb={r:255,g:0,b:0};var clr_hsv={h:0,s:0,v:0};var clr_rgbBase={r:255,g:0,b:0};var clr_isSetup=false;function clr_setup(){if(document.getElementById("color_mod")){if(window.addEventListener){setTimeout("document.addEventListener(\"click\", clr_cancel, false)",100);document.getElementById("color_mod").addEventListener("click",eventStop,false);document.getElementById("clr_shower").addEventListener("click",eventStop,false);}else if(window.attachEvent){setTimeout("document.attachEvent('onclick', clr_cancel)",100);document.getElementById("color_mod").attachEvent('onclick',eventStop);document.getElementById("clr_shower").attachEvent("onclick",eventStop);}clr_isSetup=true;}}function getMouseCoordinate(Evtevent){xC=(Evtevent)?Evtevent.pageX-document.documentElement.scrollLeft:event.clientX;yC=(Evtevent)?Evtevent.pageY-document.documentElement.scrollTop:event.clientY;}function clr_cancel(){;document.getElementById('color_mod').style.display='none';}function clr_show(){if(!clr_isSetup)clr_setup();clr_advance();document.getElementById('color_mod').style.display='block';}function clr_advance(){if(document.getElementById("clr_adv").checked)document.getElementById("clr_base").style.display="block";else document.getElementById("clr_base").style.display="none";}function clr_hsvrgb(h,s,v){var tmpRgb={r:0,g:0,b:0};if(h<60){tmpRgb.r=255;tmpRgb.g=(h/60)*255;}else if(h<120){tmpRgb.r=(1-(h-60)/60)*255;tmpRgb.g=255;}else if(h<180){tmpRgb.g=255;tmpRgb.b=((h-120)/60)*255;}else if(h<240){tmpRgb.g=(1-(h-180)/60)*255;tmpRgb.b=255;}else if(h<300){tmpRgb.r=((h-240)/60)*255;tmpRgb.b=255;}else{tmpRgb.r=255;tmpRgb.b=(1-(h-300)/60)*255;}tmpRgb.r=Math.round((1-(1-(tmpRgb.r/255))*(s/100))*(v/100*255));tmpRgb.g=Math.round((1-(1-(tmpRgb.g/255))*(s/100))*(v/100*255));tmpRgb.b=Math.round((1-(1-(tmpRgb.b/255))*(s/100))*(v/100*255));return tmpRgb;}function falsefunc(){return false;}function clr_VertColor(degrees){if(degrees==360)degrees=359;clr_hsv.h=Math.round(degrees);clr_rgbBase={r:0,g:0,b:0};if(degrees<60){clr_rgbBase.r=255;clr_rgbBase.g=(degrees/60)*255;}else if(degrees<120){clr_rgbBase.r=(1-(degrees-60)/60)*255;clr_rgbBase.g=255;}else if(degrees<180){clr_rgbBase.g=255;clr_rgbBase.b=((degrees-120)/60)*255;}else if(degrees<240){clr_rgbBase.g=(1-(degrees-180)/60)*255;clr_rgbBase.b=255;}else if(degrees<300){clr_rgbBase.r=((degrees-240)/60)*255;clr_rgbBase.b=255;}else{clr_rgbBase.r=255;clr_rgbBase.b=(1-(degrees-300)/60)*255;}document.getElementById("clr_base").style.backgroundColor="rgb("+Math.round(clr_rgbBase.r)+","+Math.round(clr_rgbBase.g)+","+Math.round(clr_rgbBase.b)+")";}function eventStop(evt){evt=evt||event;if(evt.stopPropagation)evt.stopPropagation();else evt.cancelBubble=true;}var clr_OJ,clr_OJ2,mouseDownX,clr_MType;function clr_chooseColor(OJ,OJ2,MType){clr_OJ=OJ;clr_OJ2=OJ2;clr_MType=MType;document.getElementById("clr_oldColor").style.backgroundColor="rgb("+clr_rgb.r+","+clr_rgb.g+","+clr_rgb.b+")";document.onmousedown=falsefunc;clr_Posi=clr_getOJPosition(clr_OJ2);document.onmousemove=function(evt){getMouseCoordinate(evt);clr_localPoint();return false;};document.onmouseup=function(evt){getMouseCoordinate(evt);clr_localPoint();document.onmousedown=null;document.onmousemove=null;document.onmouseup=null;};}function clr_localPoint(){if(clr_MType!="hm"){var pointerOffset=7;var willtoX=xC-clr_Posi.x;if(willtoX<0){willtoX=1;}else if(willtoX>(clr_OJ2.clientWidth+1)){willtoX=clr_OJ2.clientWidth+1;}clr_OJ.style.left=willtoX-pointerOffset+"px";}else var pointerOffset=4;willtoY=yC-clr_Posi.y;if(willtoY<0)willtoY=1;else if(clr_MType!="hm"){if(willtoY>(clr_OJ2.clientHeight+1))willtoY=clr_OJ2.clientHeight+1;}else{if(willtoY>(clr_OJ2.clientHeight))willtoY=clr_OJ2.clientHeight;}clr_OJ.style.top=willtoY-pointerOffset+"px";if(clr_MType=="hm")clr_VertColor((1-(willtoY-1)/199)*360);clr_getColor();}function clr_getColor(){if(document.getElementById("clr_base").style.display!="none"){var x=((document.getElementById("pointerC").offsetLeft+6)/200)*255;var y=255-((document.getElementById("pointerC").offsetTop+6)/200)*255;clr_hsv.s=Math.round(x/255*100);clr_hsv.v=Math.round(y/255*100);clr_rgb.r=Math.round((1-(1-(clr_rgbBase.r/255))*(x/255))*y);clr_rgb.g=Math.round((1-(1-(clr_rgbBase.g/255))*(x/255))*y);clr_rgb.b=Math.round((1-(1-(clr_rgbBase.b/255))*(x/255))*y);}else{clr_hsv.s=100;clr_hsv.v=100;clr_rgb.r=Math.round(clr_rgbBase.r);clr_rgb.g=Math.round(clr_rgbBase.g);clr_rgb.b=Math.round(clr_rgbBase.b);}document.getElementById("clr_RField").value=clr_rgb.r;document.getElementById("clr_GField").value=clr_rgb.g;document.getElementById("clr_BField").value=clr_rgb.b;document.getElementById("clr_newColor").style.backgroundColor="rgb("+clr_rgb.r+","+clr_rgb.g+","+clr_rgb.b+")";}function rgb2hsv(rV,gV,bV){var tmp_hsv={h:0,s:0,v:0};tmp_hsv.v=Math.max(rV,gV,bV);var tmp_min=Math.min(rV,gV,bV);var tmp_def=tmp_hsv.v-tmp_min;if(tmp_hsv.v==0){tmp_hsv.s=0;}else{tmp_hsv.s=Math.round(tmp_def/tmp_hsv.v*100);}if(tmp_min==tmp_hsv.v){tmp_hsv.h=0;}else if(tmp_hsv.v==rV){tmp_hsv.h=(6+(gV-bV)/tmp_def);}else if(tmp_hsv.v==gV){tmp_hsv.h=(2+(bV-rV)/tmp_def);}else if(tmp_hsv.v==bV){tmp_hsv.h=(4+(rV-gV)/tmp_def);}tmp_hsv.v=Math.round(tmp_hsv.v/255*100);if(tmp_hsv.s==0||tmp_hsv.v==0){tmp_hsv.h=360;}else{tmp_hsv.h=Math.round(tmp_hsv.h*60%360);}return tmp_hsv;}function clr_confirm(){document.getElementById('color_mod').style.display='none';if(document.getElementById("clr_adv").checked)document.forms['search'].q.value="color:hsv("+((clr_hsv.s==0||clr_hsv.v==0)?360:clr_hsv.h)+","+clr_hsv.s+","+clr_hsv.v+")";else document.forms['search'].q.value="color:h("+((clr_hsv.s==0||clr_hsv.v==0)?360:clr_hsv.h)+")";document.forms['search'].q.value+=";err:"+document.getElementById("clr_error").value;document.forms['search'].q.focus();search_change();}function clr_getOJPosition(OJ){this.OJ=OJ;this.OJ2=OJ;var coOJSy=OJ.offsetTop;var coOJSx=OJ.offsetLeft;while(this.OJ.offsetParent){coOJSy+=this.OJ.offsetParent.offsetTop;coOJSx+=this.OJ.offsetParent.offsetLeft;this.OJ=this.OJ.offsetParent;}while(this.OJ2.parentNode){if(this.OJ2.parentNode.scrollTop)coOJSy-=this.OJ2.parentNode.scrollTop;if(this.OJ2.parentNode.scrollLeft)coOJSx-=this.OJ2.parentNode.scrollLeft;OJ2=this.OJ2.parentNode;}return{x:coOJSx,y:coOJSy};}
