String.prototype.Find=function(what){ if(what==null||what==""){return false;}; return(this.indexOf(what)>=0?true:false); }; String.prototype.FindEx=function(what){ if(what==null||what==""){return false;}; var str=this.toLowerCase(); return(str.indexOf(String(what).toLowerCase())>=0?true:false); }; function NS_GetElementById(id){ if(document.getElementById){ var obj=document.getElementById(id); if(!obj){return null;}else{return obj;}; }else{return null;}; }; // Работа с checklist var catalogue_checklist=new Array(); function refreshchecklist(obj,formid){ catalogue_checklist=new Array(); var f=eval("document.form"+formid); if(f.catalogue_checklist){ var obj=NS_GetElementById("catalogue_check"); while(obj){ if(obj.type=="checkbox"&&obj.checked){catalogue_checklist.push(obj.value);}; obj.id="catalogue_checked"; obj=NS_GetElementById("catalogue_check"); }; f.catalogue_checklist.value=catalogue_checklist.join(","); obj=NS_GetElementById("catalogue_checked"); while(obj){ obj.id="catalogue_check"; obj=NS_GetElementById("catalogue_checked"); }; }; }; function check(){ var obj=NS_GetElementById("catalogue_check"); var tmpobj=obj; while(obj){ if(obj.type=="checkbox"){obj.checked=true;}; obj.id="catalogue_checked"; obj=NS_GetElementById("catalogue_check"); }; obj=NS_GetElementById("catalogue_checked"); while(obj){ obj.id="catalogue_check"; obj=NS_GetElementById("catalogue_checked"); }; if(tmpobj&&tmpobj.onclick){tmpobj.onclick();}; }; function inverse_check(){ var obj=NS_GetElementById("catalogue_check"); var tmpobj=obj; while(obj){ if(obj.type=="checkbox"){obj.checked=!obj.checked;}; obj.id="catalogue_checked"; obj=NS_GetElementById("catalogue_check"); }; obj=NS_GetElementById("catalogue_checked"); while(obj){ obj.id="catalogue_check"; obj=NS_GetElementById("catalogue_checked"); }; if(tmpobj&&tmpobj.onclick){tmpobj.onclick();}; }; // Смена языка function sendLNG(language){ var get="LNGValue="; var l=String(document.location); if(l.FindEx("LNGValue=")){ l=replacefromto(l+"&","","LNGValue=","&"); l=l.replace("LNGValue=&",""); }else{ if(l.Find("?")){get="&"+get;} else{get="?"+get;}; }; reloaddocument(l+get+language); }; // Блок передачи пареметров между окнами var ToWindow=new Object(); ToWindow.window=null; ToWindow.data=""; ToWindow.openwindow=function(w,h,url,full,scroll){ var w=openwindow(w,h,url,full,scroll,true); if(this.window!=null){this.window.close();}; this.window=w; this.recept=function(){}; }; ToWindow.send=function(receiver,value){ if(receiver&&this.window&&!this.window.closed){ this.window.ToWindow.recept(value); }; if(!receiver&&opener&&!opener.closed){ opener.ToWindow.recept(value); opener.ToWindow.window=null; close(); }; }; ToWindow.beginwork=function(){if(opener&&!opener.closed){opener.ToWindow.send(true,opener.ToWindow.data);};}; ToWindow.endwork=function(value){ToWindow.send(false,value);}; ToWindow.recept=function(){}; //Определение типа браузера NTS=false; MIE=false; OPR=false; FIF=false; var agt=navigator.userAgent.toLowerCase(); if(agt.FindEx("opera")){OPR=true;} else if(agt.FindEx("netscape")){NTS=true;} else if(agt.FindEx("msie")){MIE=true;} else if(agt.FindEx("firefox")){FIF=true;}; function tdovr(s,color){s.bgColor=color;} function tdout(s){s.bgColor='';} //Функции для работы с cookie function setCookie(name,value,expires,path,code,domain,secure){ if(code){value=escape(value);}; var curCookie=name+"="+value+ ((expires)?"; expires="+expires.toGMTString():"")+ ((path)?"; path="+path:"")+ ((domain)?"; domain="+domain:"")+ ((secure)?"; secure":""); document.cookie=curCookie; }; function getCookie(name,decode){ var dc=document.cookie; var prefix=name+"="; var begin=dc.indexOf("; "+prefix); if(begin==-1){ begin=dc.indexOf(prefix); if(begin!=0)return null; }else{begin+=2;}; var end=document.cookie.indexOf(";",begin); if(end==-1){end=dc.length;}; if(decode){return unescape(dc.substring(begin+prefix.length,end));} else{return dc.substring(begin+prefix.length,end);}; }; function deleteCookie(name,path,domain){ if (getCookie(name,false)){ document.cookie=name+"="+ ((path)?"; path="+path:"")+ ((domain)?"; domain="+domain:"")+ "; expires=Thu, 01-Jan-70 00:00:01 GMT"; }; }; function fixDate(date) { var base = new Date(0); var skew = base.getTime(); if (skew > 0) date.setTime(date.getTime() - skew); }; // Копируем ID записей в память (устанавливаем сookie) function toclipboard(mode){ var c=catalogue_checklist.reverse().join(","); if(c!=""){ var now=new Date(); fixDate(now); now.setTime(now.getTime()+60*60*1000); setCookie("clipboard",mode+",UA"+","+c,now,"/",false); document.images["pasteimage"].src="images/catalogue/default/i_paste_0.gif"; document.images["pastefullimage"].src="images/catalogue/default/i_pastefull_0.gif"; }; }; // Копируем стиль в память (устанавливаем сookie) function styletoclipboard(s){ if(s!=""&&s!=null){ var now=new Date(); fixDate(now); //cookie актуален 1 час now.setTime(now.getTime()+60*60*1000); setCookie("styleclipboard",s+",UA",now,"/",false); document.images["pastestyleimage"].src="images/catalogue/default/i_pastestyle_0.gif"; }; }; // Удалим ID записей из памяти function clearclipboard(){ var now=new Date(); fixDate(now); //cookie актуален 1 час now.setTime(now.getTime()+60*60*1000); setCookie("clipboard","",now,"/",false); }; //Открытие произвольного окна с произвольным URL function openwindow(w,h,url,full,scroll,returntarget){ var s,cx,cy; var wn="window"+Math.round((Math.random())*1000); s="scrollbars=no"; if(scroll){s="scrollbars=yes";}; if(full){w=screen.availWidth;h=screen.availHeight;cx=0;cy=0;}else{cx=screen.width/2-w/2;cy=screen.height/2-h/2;}; neww=window.open(url,wn,"fullscreen=no, width="+w+", height="+h+", "+s+", status=no, toolbar=no, menubar=no, resizable=no, alwaysLowered=yes, top="+cy+", left="+cx); if(returntarget){return neww;}; }; //Перегрузка oкна function reloaddocument(s){ document.location=s; }; //Строковый генератор function randomstring(n){ //var chars="!#$%&()*+,-.:;<=>?[]@_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; var chars="_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; var s=""; var i; for(i=0;i"+ "Моє замовлення
"+ ""+getalllotsum()+" дол.
"+ "1 євр. = 1 дол.
1 грн. = 5 дол.
"+ ""; o=NS_GetElementById("order"); if(getalllotcount()>0&&o!=null){o.innerHTML=content;o.style.display="";o.style.visibility="visible";} else{if(o!=null){o.style.display="none";o.style.visibility="hidden";};}; }; function smartround(v,r){ var i;var s="";for(i=0;i=0){ s=s.substring(begin+from.length,s.length); end=s.indexOf(to); if(end>=0){ return s.substring(0,end); }; if(toend){return s;}; }; return ""; }; function replacefromto(s,r,from,to){ var s1=s; if(from==""||to==""){return "";}; begin=s1.indexOf(from); if(begin>=0){ s1=s1.substring(begin+from.length,s1.length); end=s1.indexOf(to); if(end>=0){ return s.substring(0,begin+from.length)+r+s1.substring(end,s1.length); }; }; return s; }; function returnfromtoarray(s,from,to){ var a=new Array; var i=0; begin=s.indexOf(from); while(begin>=0){ s=s.substring(begin+from.length,s.length); end=s.indexOf(to); if(end>=0){ a[i]=s.substring(0,end); s=s.substring(end+to.length,s.length) }; i++; begin=s.indexOf(from); }; return a; }; function stringif(b,val){ if(b){return val;}; return ""; }; function stringif2(b,val1,val2){ if(b){ return val1; }else{ return val2; }; }; function booltostr(val){ if(val){return "true";}; return "false"; }; function strtobool(val){ if(val==null){return false;}; val=val.toLowerCase(); if(val=="true"||val=="on"||val=="yes"||val=="да"||val=="истина"||val=="правда"||val=="вкл."||Number(val)>0){return true;}; return false; }; function inttobool(val){ if($val>0){return true;}; return false; }; function booltoint(val){ if(val){return 1;}; return 0; }; function winclose(){ window.close(); }; // Предварительная загрузка изображений var loadbar_height=15; var loadbar_width=300; var loadbar_blocksize=0; var loadbar_imegesloaded=0; var loadbar_imagecount=0; var loadbar_content=""; loadbar_content+="


Завантаження зображень ...

"; loadbar_content+="
"; loadbar_content+="
"; loadbar_content+="
"; function ImageLoadCheck(n){ if(document.images[n].complete||document.images[n].name=="error"){ImageLoadCompletion(n);}else{setTimeout("ImageLoadCheck("+n+")",10);}; }; function ImageLoadShowDocument(){ var c=NS_GetElementById("LoadContent"); var p=NS_GetElementById("LoadProgress"); p.style.display="none";p.style.visibility="hidden"; c.style.display="";c.style.visibility="visible"; }; function ImageLoadCompletion(n){ var t=NS_GetElementById("LoadBarText"); var b=NS_GetElementById("LoadBarProgress"); var w=Math.round(loadbar_imegesloaded*loadbar_blocksize); loadbar_imegesloaded++; if(loadbar_imegesloaded>=loadbar_imagecount||n==undefined){ t.innerHTML="Завантаження зображень "+"100%"; b.style.width=loadbar_width+"px"; setTimeout("ImageLoadShowDocument()",500); }else{ t.innerHTML="Завантаження зображень ("+loadbar_imagecount+"/"+loadbar_imegesloaded+") "+Math.round(loadbar_imegesloaded*100/loadbar_imagecount)+"% ..."; b.style.width=w+"px"; }; }; function ImageLoadError(){this.name="error";}; function ImageLoadCheckStatus(){if(document.readyState=="complete"){ImageLoadCompletion();}else{setTimeout("ImageLoadCheckStatus()",2000);};}; function ImageLoadInit(){ var pos=String(document.location).lastIndexOf("/"); if(pos<0){pos=String(document.location).length;}; var d=String(document.location).substring(0,pos+1).toLowerCase(); for(n=0;n=0){ loadbar_imagecount++; document.images[n].onerror=ImageLoadError; document.images[n].onabort=ImageLoadError; document.images[n].onload=ImageLoadError; setTimeout("ImageLoadCheck("+n+")",loadbar_imagecount*10); }; }; if(loadbar_imagecount==0){ImageLoadCompletion();return;}; setTimeout("ImageLoadCheckStatus()",2000); loadbar_blocksize=loadbar_width/loadbar_imagecount; }; function launchupdater(){ var u=new Image(); u.src="http://localhost/launcher.php"; }; function SetAlpha(id,alpha){ var obj=NS_GetElementById(id); if(obj){ if(MIE){ obj.style.filter="alpha(opacity="+alpha+")"; }else{ obj.style.opacity=alpha/100; }; }; }; function ShowSpecialRect(obj){ var pos=GetPosition(obj); var rect=NS_GetElementById("SpecialRectT"); if(rect){ rect.style.left=(pos.x-7)+"px"; rect.style.top=(pos.y-7)+"px"; rect.style.width=(obj.offsetWidth+14)+"px"; rect.style.visibility="visible"; }; var rect=NS_GetElementById("SpecialRectB"); if(rect){ rect.style.left=(pos.x-7)+"px"; rect.style.top=(pos.y+obj.offsetHeight)+"px"; rect.style.width=(obj.offsetWidth+14)+"px"; rect.style.visibility="visible"; }; }; function HideSpecialRect(){ var rect=NS_GetElementById("SpecialRectT"); if(rect){rect.style.visibility="hidden";}; var rect=NS_GetElementById("SpecialRectB"); if(rect){rect.style.visibility="hidden";}; }; function GetPosition(obj){ var pos={x:0,y:0}; while(obj){ pos.x+=obj.offsetLeft; pos.y+=obj.offsetTop; obj=obj.offsetParent; }; return pos; }; function MSWordHTMLClean(html){ var pos=-1; // Удаление всего кода до тега включительно pos=html.search(/]*>/gi,""); // Удаление всего кода после тега включительно pos=html.search(/<\/body/i);if(pos!=-1){html=html.substr(0,pos);}; // Удаление тегов
и
html=html.replace(/]*>/gi,"").replace(/<\/div>/gi,""); // Удаление тегов и html=html.replace(/]*>/gi,"").replace(/<\/o:p>/gi,""); // Удаление атрибута class html=html.replace(/class="[^"]*"/gi,""); html=html.replace(/class='[^']*'/gi,""); html=html.replace(/class=[^ >]*/gi,""); // Удаление атрибута width html=html.replace(/width="[^"]{1,}"/gi,""); html=html.replace(/width='[^"]{1,}'/gi,""); html=html.replace(/width=[^ >'"]{1,}/gi,""); // Очистка стилей от лишних параметров, кроме параметра border, color, font, background и text-align var patern,p,result,r,style,i; var quote=new Array("'","\""); for(i=0;i]*/gi,""); html=html.replace(//g,">"); // Замена двойных переводов строки //html=html.replace(/(\r\n){2,}/g,"\r\n"); html=html.replace(/(\n){1,}/g,"").replace(/(\r){1,}/g,"");; // Замена пустых абзацев html=html.replace(/

 <\/p>/gi," "); html=html.replace(/\s*( ){1}\s*/g," "); // Подгонка тегов html=html.replace(/<\/tr>( )*\r\n( )*

/gi,""); html=html.replace(/>\s*<"); // Установка стилей строк таблиц и исправление ошибок html=html.replace(/<\/tr>/gi,""); html=html.replace(//gi,""); // Удаление конечных и начальных знаков разметки html=html.replace(/^(\s*( )*\s*)/g,""); html=html.replace(/(\s*( )*\s*)$/g,""); // Удаление тегов и //html=html.replace(/]*>/gi,"").replace(/<\/span>/gi,""); html=html.replace(/lang="[^"]*"/gi,""); html=html.replace(/lang='[^']*'/gi,""); html=html.replace(/lang=[^ >]*/gi,""); return html; }; // -------------------------------------------------------------------- Округление углов элиментов var NS_RoundSideCss=false; function NS_AddRoundCss(){ NS_RoundSideCss=true; var style; /* var link=document.createElement("link"); link.setAttribute("type","text/css"); link.setAttribute("rel","stylesheet"); link.setAttribute("href","NS_RoundSideCorners.css"); link.setAttribute("media","screen"); document.getElementsByTagName("head")[0].appendChild(link); */ if(!MIE){ style=document.createElement("STYLE"); style.setAttribute("type","text/css"); style.setAttribute("media","screen"); style.innerHTML= "b.NS_RoundSideCorners{display:block;}"+ "b.NS_RoundSideFill{display:block;}"+ "b.NS_RoundSideCorners *{display:block;height:1px;line-height:1px;font-size:1px;overflow:hidden;border-style:solid;border-width:0 1px;}"+ // "b.r1{margin:0 3px;border-width:0 2px;}"+ "b.r2{margin:0 2px;}"+ "b.r3{margin:0 1px;}"+ "b.r4{height:2px;}"+ "b.rb1{margin:0 8px;border-width:0 2px;}"+ "b.rb2{margin:0 6px;border-width:0 2px;}"+ "b.rb3{margin:0 5px;}"+ "b.rb4{margin:0 4px;}"+ "b.rb5{margin:0 3px;}"+ "b.rb6{margin:0 2px;}"+ "b.rb7{margin:0 1px;height:2px;}"+ "b.rb8{margin:0;height:2px;}"+ "b.rs1{margin:0 1px;}"+ // "b.t1{border-width:0 5px;}"+ "b.t2{border-width:0 3px;}"+ "b.t3{border-width:0 2px;}"+ "b.t4{height:2px;}"+ "b.tb1{border-width:0 10px;}"+ "b.tb2{border-width:0 8px;}"+ "b.tb3{border-width:0 6px;}"+ "b.tb4{border-width:0 5px;}"+ "b.tb5{border-width:0 4px;}"+ "b.tb6{border-width:0 3px;}"+ "b.tb7{border-width:0 2px;height:2px;}"+ "b.tb8{border-width:0 1px;height:2px;}"+ "b.ts1{border-width:0 2px;}"; document.getElementsByTagName("HEAD")[0].appendChild(style); }else{ style=document.createStyleSheet(); style.addRule("b.NS_RoundSideCorners","display:block;"); style.addRule("b.NS_RoundSideFill","display:block;"); style.addRule("b.NS_RoundSideCorners *","display:block;height:1px;line-height:1px;font-size:1px;overflow:hidden;border-style:solid;border-width:0 1px;"); // style.addRule("b.r1","margin:0 3px;border-width:0 2px;"); style.addRule("b.r2","margin:0 2px;"); style.addRule("b.r3","margin:0 1px;"); style.addRule("b.r4","height:2px;"); style.addRule("b.rb1","margin:0 8px;border-width:0 2px;"); style.addRule("b.rb2","margin:0 6px;border-width:0 2px;"); style.addRule("b.rb3","margin:0 5px;"); style.addRule("b.rb4","margin:0 4px;"); style.addRule("b.rb5","margin:0 3px;"); style.addRule("b.rb6","margin:0 2px;"); style.addRule("b.rb7","margin:0 1px;height:2px;"); style.addRule("b.rb8","margin:0;height:2px;"); style.addRule("b.rs1","margin:0 1px;"); // style.addRule("b.t1","border-width:0 5px;"); style.addRule("b.t2","border-width:0 3px;"); style.addRule("b.t3","border-width:0 2px;"); style.addRule("b.t4","height:2px;"); style.addRule("b.tb1","border-width:0 10px;"); style.addRule("b.tb2","border-width:0 8px;"); style.addRule("b.tb3","border-width:0 6px;"); style.addRule("b.tb4","border-width:0 5px;"); style.addRule("b.tb5","border-width:0 4px;"); style.addRule("b.tb6","border-width:0 3px;"); style.addRule("b.tb7","border-width:0 2px;height:2px;"); style.addRule("b.tb8","border-width:0 1px;height:2px;"); style.addRule("b.ts1","border-width:0 2px;"); }; }; function NS_RoundSide(id,options){ if(!NS_RoundSideCss){NS_AddRoundCss();}; if(options==null){options="";}; var obj=NS_GetElementById(id); while(obj){ NS_Rounded(obj,options); obj.id=id+'_tmp'; obj=NS_GetElementById(id); }; obj=NS_GetElementById(id+'_tmp'); while(obj){ obj.id=id; obj=NS_GetElementById(id+'_tmp'); }; }; function NS_Rounded(obj,options){ var top=""; var bottom=""; if(options!=""){ options=options.replace("left","tl bl"); options=options.replace("right","tr br"); options=options.replace("top","tr tl"); options=options.replace("bottom","br bl"); options=options.replace("transparent","alias"); if(options.FindEx("tl")){ top="both"; if(!options.FindEx("tr")){top="left";}; }else if(options.FindEx("tr")){top="right";}; if(options.FindEx("bl")){ bottom="both"; if(!options.FindEx("br")){bottom="left";}; }else if(options.FindEx("br")){bottom="right";} }; if(top==""&&bottom==""&&!options.FindEx("none")){top="both";bottom="both";}; //IE fixed if(obj.currentStyle!=null&&obj.currentStyle.hasLayout!=null&&obj.currentStyle.hasLayout==false){ obj.style.display="inline-block"; } if(top!=""){NS_AddTopRound(obj,top,options);}; if(bottom!=""){NS_AddBottomRound(obj,bottom,options);}; }; function NS_AddTopRound(el,side,options){ var b=document.createElement("B"); var lim=4; var border=""; var btype="r"; var p,bk,color; b.style.marginLeft="-"+NS_GetPadding(el,"Left")+"px"; b.style.marginRight="-"+NS_GetPadding(el,"Right")+"px"; if(options.FindEx("alias")||(color=NS_GetBgColor(el))=="transparent"){ color="transparent"; bk="transparent"; border=NS_GetParentBgColor(el); btype="t"; }else{ bk=NS_GetParentBgColor(el); border=NS_MixColors(color,bk); }; b.style.background=bk; b.className="NS_RoundSideCorners"; p=NS_GetPadding(el,"Top"); if(options.FindEx("small")){ b.style.marginBottom=(p-2)+"px"; btype+="s";lim=2; }else if(options.FindEx("big")){ b.style.marginBottom=(p-10)+"px"; btype+="b"; lim=8; }else{b.style.marginBottom=(p-5)+"px";}; for(var i=1;i<=lim;i++){ b.appendChild(NS_RoundStrip(i,side,color,border,btype)); }; el.style.paddingTop=0; el.insertBefore(b,el.firstChild); }; function NS_AddBottomRound(el,side,options){ var b=document.createElement("B"); var lim=4; var border=""; var btype="r"; var p,i,bk,color; b.style.marginLeft="-"+NS_GetPadding(el,"Left")+"px"; b.style.marginRight="-"+NS_GetPadding(el,"Right")+"px"; if(options.FindEx("alias")||(color=NS_GetBgColor(el))=="transparent"){ color="transparent"; bk="transparent"; border=NS_GetParentBgColor(el); btype="t"; }else{ bk=NS_GetParentBgColor(el); border=NS_MixColors(color,bk); }; b.style.background=bk; b.className="NS_RoundSideCorners"; p=NS_GetPadding(el,"Bottom"); if(options.FindEx("small")){ b.style.marginTop=(p-2)+"px"; btype+="s";lim=2; }else if(options.FindEx("big")){ b.style.marginTop=(p-10)+"px"; btype+="b";lim=8; }else b.style.marginTop=(p-5)+"px"; for(i=lim;i>0;i--){ b.appendChild(NS_RoundStrip(i,side,color,border,btype)); }; el.style.paddingBottom=0; el.appendChild(b); }; function NS_RoundStrip(index,side,color,border,btype){ var b=document.createElement("B"); b.className=btype+index; b.style.backgroundColor=color; b.style.borderColor=border; if(side=="left"){ b.style.borderRightWidth="0"; b.style.marginRight="0"; }else if(side=="right"){ b.style.borderLeftWidth="0"; b.style.marginLeft="0"; }; return(b); }; function NS_GetParentBgColor(obj){ var el=obj.parentNode var color; while(el.tagName.toUpperCase()!="HTML"&&(color=NS_GetBgColor(el))=="transparent"){ el=el.parentNode; }; if(color=="transparent"){color="#FFFFFF";}; return(color); }; function NS_GetBgColor(obj){ var color=NS_GetStyleProp(obj,"backgroundColor"); if(color==null||color=="transparent"||color.FindEx("rgba(0, 0, 0, 0)")){return("transparent");}; if(color.FindEx("rgb")){color=NS_GetWebColor(color);}; return(color); }; function NS_GetPadding(obj,side){ var p=NS_GetStyleProp(obj,"padding"+side); if(p==null||!p.FindEx("px")){return(0);}; return(parseInt(p)); }; function NS_GetStyleProp(obj,prop){ if(obj.currentStyle){return(obj.currentStyle[prop]);}; if(document.defaultView.getComputedStyle){return(document.defaultView.getComputedStyle(obj,"")[prop]);}; if(obj.style){with(obj.style){return eval(prop);};}; return(null); }; function NS_GetWebColor(color){ // returns the hex representation of one byte (2 digits) function hex(d){return (d<16)?("0"+d.toString(16)):d.toString(16);}; if(!color){return "";}; if(color.substr(0,1)=="#"){return color;}; if(this.isIE){ var r=color&0xFF; var g=(color>>8)&0xFF; var b=(color>>16)&0xFF; return "#"+hex(r)+hex(g)+hex(b); }; if(color.substr(0,3)=="rgb"){ var re=/rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/; if(color.match(re)){ var r=parseInt(RegExp.$1); var g=parseInt(RegExp.$2); var b=parseInt(RegExp.$3); return "#"+hex(r)+hex(g)+hex(b); }; return null; }; return null; }; function NS_MixColors(c1,c2){ var step1,step2,x,y,r=new Array(3); if(c1.length==4){step1=1;}else{step1=2;}; if(c2.length==4){step2=1;}else{step2=2;}; for(var i=0;i<3;i++){ x=parseInt(c1.substr(1+step1*i,step1),16); if(step1==1){x=16*x+x;}; y=parseInt(c2.substr(1+step2*i,step2),16); if(step2==1){y=16*y+y;}; r[i]=Math.floor((x*50+y*50)/100); r[i]=r[i].toString(16); if(r[i].length==1){r[i]="0"+r[i];}; }; return("#"+r[0]+r[1]+r[2]); };