/*
Doron Sol(bonsite.co.il)
*/
var cbxH="25";var radH="25";var recall=false;var Custom={init:function(){var e=$Tag("input"),g=Array(),c,f,h;var k=$Tag("label");for(a=0;a<e.length;a++){if((e[a].type=="checkbox"||e[a].type=="radio")&&e[a].getAttribute("nocfe")==null){g[a]=document.createElement("span");g[a].className=e[a].type;if(e[a].checked==true){if(e[a].type=="checkbox"){position="0 -"+(cbxH*2)+"px";g[a].style.backgroundPosition=position}else{position="0 -"+(radH*2)+"px";g[a].style.backgroundPosition=position}}e[a].parentNode.insertBefore(g[a],e[a]);e[a].onchange=Custom.clear;if(!e[a].disabled){g[a].onmousedown=Custom.pushed;g[a].onmouseup=Custom.check;document.onmouseup=Custom.clear;if(e[a].type=="checkbox"||e[a].type=="radio"){for(var j=0;j<k.length;j++){if(k[j].htmlFor==e[a].id){if(document.all){k[j].onmousedown=Custom.pushed2;k[j].onmouseup=Custom.check2}else{k[j].onclick=Custom.pushed2}}}}}e[a].className="styled"}}Custom.initSelect()},initSelect:function(){var e=$Tag("select"),g=Array(),c,f,h;for(a=0;a<e.length;a++){if(!e[a].multiple&&e[a].getAttribute("nocfe")==null){f=e[a].getElementsByTagName("option");h="";if(f.length>0&&f[0].childNodes[0].nodeValue!=null){h=f[0].childNodes[0].nodeValue}c=document.createTextNode(h);for(b=0;b<f.length;b++){if(f[b].selected==true){c=document.createTextNode(f[b].childNodes[0].nodeValue)}}g[a]=document.createElement("span");g[a].className="select "+e[a].className;if(e[a].style.width!=""){w=parseInt(e[a].style.width.replace("px",""));xh=((!document.all)||(IsX()&&document.all))?4:0;g[a].style.width=(w-xh)+"px"}if(e[a].id){g[a].id="select"+e[a].id}else{g[a].id="select"+e[a].name}if(!$G(g[a].id)||!recall){g[a].appendChild(c);e[a].parentNode.insertBefore(g[a],e[a]);e[a].handler=e[a].onchange;e[a].onchange=Custom.choose}e[a].className="styled"}else{e[a].className=e[a].className.replace(/styled/gi,"")}}recall=true},pushed:function(){element=this.nextSibling;if(element.checked==true&&element.type=="checkbox"){this.style.backgroundPosition="0 -"+cbxH*3+"px"}else{if(element.checked==true&&element.type=="radio"){this.style.backgroundPosition="0 -"+radH*3+"px"}else{if(element.checked!=true&&element.type=="checkbox"){this.style.backgroundPosition="0 -"+cbxH+"px"}else{this.style.backgroundPosition="0 -"+radH+"px"}}}},pushed2:function(){element=$G(this.htmlFor);if(element.checked==true&&element.type=="checkbox"){this.style.backgroundPosition="0 -"+cbxH*3+"px"}else{if(element.checked==true&&element.type=="radio"){this.style.backgroundPosition="0 -"+radH*3+"px"}else{if(element.checked!=true&&element.type=="checkbox"){this.style.backgroundPosition="0 -"+cbxH+"px"}else{this.style.backgroundPosition="0 -"+radH+"px"}}}},check:function(){element=this.nextSibling;if(element.checked==true&&element.type=="checkbox"){this.style.backgroundPosition="0 0";element.checked=false}else{if(element.type=="checkbox"){this.style.backgroundPosition="0 -"+cbxH*2+"px"}else{this.style.backgroundPosition="0 -"+radH*2+"px";group=this.nextSibling.name;inputs=$Tag("input");for(a=0;a<inputs.length;a++){if(inputs[a].name==group&&inputs[a]!=this.nextSibling){inputs[a].previousSibling.style.backgroundPosition="0 0"}}}element.checked=true}if(element.type=="checkbox"||element.type=="radio"){if(element.onclick){element.onclick()}}},check2:function(){element=$G(this.htmlFor);if(element.checked==true&&element.type=="checkbox"){this.style.backgroundPosition="0 0";element.checked=false}else{if(element.type=="checkbox"){this.style.backgroundPosition="0 -"+cbxH*2+"px"}else{this.style.backgroundPosition="0 -"+radH*2+"px";group=element.name;inputs=$Tag("input");for(a=0;a<inputs.length;a++){if(inputs[a].name==group&&inputs[a]!=element){inputs[a].previousSibling.style.backgroundPosition="0 0"}}}element.checked=true}if(element.type=="checkbox"||element.type=="radio"){if(element.onclick){element.onclick()}}},clear:function(){inputs=$Tag("input");for(var c=0;c<inputs.length;c++){if(inputs[c].type=="checkbox"&&inputs[c].checked==true){inputs[c].previousSibling.style.backgroundPosition="0 -"+cbxH*2+"px"}else{if(inputs[c].type=="checkbox"){inputs[c].previousSibling.style.backgroundPosition="0 0"}else{if(inputs[c].type=="radio"&&inputs[c].checked==true){inputs[c].previousSibling.style.backgroundPosition="0 -"+radH*2+"px"}else{if(inputs[c].type=="radio"){inputs[c].previousSibling.style.backgroundPosition="0 0"}}}}}},choose:function(){RefreshDDL(this);if(this.handler){this.handler()}}};function RefreshDDL(f){if(IsIE6()){return}var e=false;var c=(f.id)?f.id:f.name;option=f.getElementsByTagName("option");if(option.length==0){document.getElementById("select"+c).childNodes[0].nodeValue="";return}for(d=0;d<option.length;d++){if(option[d].selected==true){document.getElementById("select"+c).childNodes[0].nodeValue=option[d].childNodes[0].nodeValue;e=true}}if(!e){document.getElementById("select"+c).childNodes[0].nodeValue=option[0].childNodes[0].nodeValue}}function CbxAll(e,c){if($G(e)){if($G(e).previousSibling){if($G(e).previousSibling.tagName=="SPAN"){$G(e).previousSibling.onclick=function(){CheckAll(e,c)};$G(e).previousSibling.ondblclick=function(){CheckAll(e,c)}}}}}function CheckAll(g,f){var c="";var e=$Tag("input");for(i=0;i<e.length;i++){if(e[i].type=="checkbox"){c=e[i].id;if(c.indexOf(f)>-1){e[i].checked=$G(g).checked}}}Custom.clear()}function IsX(){var e=/\s+(X?HTML)\s+([\d\.]+)\s*([^\/]+)*\//gi;var c=false;if(typeof document.namespaces!="undefined"){c=document.all[0].nodeType==8?e.test(document.all[0].nodeValue):false}else{c=document.doctype!=null?e.test(document.doctype.publicId):false}if(c){c=RegExp.$1;return(c=="XHTML")}else{return null}}if(!IsIE6()){AddLoadEvent(Custom.init)}else{document.write("<style>input.styled, .styled input {display: inline;}</style>")};

