
allowDebug=false;function getMouseXY(e){if(!e)var e=window.event;var xy={x:0,y:0};xy.x=e.pageX||e.pageY?e.pageX:e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)-(document.documentElement.clientLeft||0);xy.y=e.pageX||e.pageY?e.pageY:e.clientY+(document.documentElement.scrollTop||document.body.scrollTop)-(document.documentElement.clientTop||0);return xy;}
function findPos(obj){var xy={x:0,y:0};if(obj.offsetParent){do{xy.x+=obj.offsetLeft;xy.y+=obj.offsetTop;}while(obj=obj.offsetParent);}
return xy;}
function getWidthHeight(obj){if(obj.naturalHeight&&obj.naturalWidth>0){return{width:obj.naturalWidth,height:obj.naturalHeight};}else if(obj.width&&obj.width>0){return{width:obj.width,height:obj.height};}else if(obj.getAttribute&&obj.getAttribute('width')>0){return{width:obj.getAttribute('width'),height:obj.getAttribute('height')};}else if(obj["width"]&&obj["width"]>0){return{width:obj["width"],height:obj["height"]};}
return{width:0,height:0};}
function zoomInit(){imageZoom=document.getElementById('imageZoom');imageZoomImage=document.getElementById('imageZoomImage');imageZoomFrame=document.getElementById('imageZoomFrame');imageXY=findPos(cinemaImage);wh=getWidthHeight(cinemaImage);zGlass={w:300,h:300,m:4};zContent={w:wh.width*2,h:wh.height*2};img={x:0,y:0,w:wh.width,h:wh.height};zDiv={x:img.x-Math.round((zContent.w+zGlass.w/2-img.w)/2),y:img.y-Math.round((zContent.h+zGlass.h/2-img.h)/2),w:zContent.w+zGlass.w/2,h:zContent.h+zGlass.h/2,m:(zGlass.w+zGlass.h)/4};zoomArea={x:imageXY.x,y:imageXY.y,w:wh.width,h:wh.height};imageZoomImage.style.top=(zGlass.h/2)+'px';imageZoomImage.style.left=(zGlass.w/2)+'px';imageZoomFrame.style.position='absolute';imageZoomFrame.style.width=Math.round(zGlass.w+2*zGlass.m)+'px';imageZoomFrame.style.height=Math.round(zGlass.h+2*zGlass.m)+'px';imageZoomFrame.style.backgroundColor='#000';imageZoomFrame.style.opacity='0.5';imageZoomFrame.style.filter='alpha(opacity=50)';imageZoom.style.width=zDiv.w+'px';imageZoom.style.height=zDiv.h+'px';imageZoomFrame.style.cursor='url(\'/media/gfx/none.cur\'), pointer';imageZoom.style.cursor='url(\'/media/gfx/none.cur\'), pointer';imageZoomFramePosLeft=Math.round((zDiv.w-img.w-zGlass.w)/2)+zGlass.m;imageZoomFramePosTop=Math.round((zDiv.h-img.h-zGlass.h)/2)+zGlass.m;imageZoom.style.backgroundColor='white';topLeft=imageXY;bottomRight={x:imageXY.x+wh.width,y:imageXY.y+wh.height};document.documentElement.onmousemove=zoomIt;}
function zoomIt(e){if(!e)var e=window.event;var mouseXY=getMouseXY(e);if(check(mouseXY)){imageZoom.style.visibility='hidden';imageZoomFrame.style.visibility='hidden';document.documentElement.onmousemove='';return;}
var relativeX=mouseXY.x-imagePos.x;var relativeY=mouseXY.y-imagePos.y;var zoomWindowLeft=step1(mouseXY);var zoomWindowTop=step2(mouseXY);var zoomImageTopClip=zoomWindowTop;var zoomImageRightClip=step3(zoomWindowLeft);var zoomImageBottomClip=step4(zoomWindowTop);var zoomImageLeftClip=zoomWindowLeft;step5(relativeX,relativeY);step6(zoomWindowLeft);step7(zoomWindowTop);step8();step9();step10();}
function check(mouseXY){return(mouseXY.x<topLeft.x||mouseXY.x>bottomRight.x||mouseXY.y<topLeft.y||mouseXY.y>bottomRight.y);}
function step1(mouseXY){return mouseXY.x-zoomArea.x;}
function step2(mouseXY){return mouseXY.y-zoomArea.y;}
function step3(zoomWindowLeft){return zoomWindowLeft+zGlass.w;}
function step4(zoomWindowTop){return zoomWindowTop+zGlass.h;}
function step5(relativeX,relativeY){var zoomWindowMidPoint={x:Math.round(relativeX*(zoomArea.w-zGlass.w-zGlass.m)/zoomArea.w-relativeX*(zGlass.w/2)/zoomArea.w+zGlass.w/2),y:Math.round(relativeY*(zoomArea.h-zGlass.h-zGlass.m)/zoomArea.h-relativeY*(zGlass.h/2)/zoomArea.h+zGlass.h/2)};var boolX1=(relativeX<zGlass.w/2+zGlass.m);var boolY1=(relativeY<zGlass.h/2+zGlass.m);var boolX2=(relativeX>img.w-zGlass.w/2+zGlass.m);var boolY2=(relativeY>img.h-zGlass.h/2+zGlass.m);var clipLeft=Math.round(zDiv.m-2*zDiv.m*relativeX/(zDiv.w)+relativeX*(zDiv.w-(zGlass.w+zGlass.m))/img.w);var clipTop=Math.round(zDiv.m-2*zDiv.m*relativeY/(zDiv.h)+relativeY*(zDiv.h-(zGlass.h+zGlass.m))/img.h);imageZoom.style.clip='rect('+clipTop+'px '+(clipLeft+zGlass.w)+'px '+(clipTop+zGlass.h)+'px '+clipLeft+'px)';imageZoom.style.left=Math.round(-(zDiv.m-2*zDiv.m*relativeX/(zDiv.w))+relativeX*(img.w-zDiv.w)/img.w)+'px';imageZoom.style.top=Math.round(-(zDiv.m-2*zDiv.m*relativeY/(zDiv.h))+relativeY*(img.h-zDiv.h)/img.h)+'px';imageZoomFrame.style.left=Math.round(zoomWindowMidPoint.x-zGlass.m-zGlass.w/2+zGlass.w*relativeX/(2*zoomArea.w))+'px';imageZoomFrame.style.top=Math.round(zoomWindowMidPoint.y-zGlass.m-zGlass.h/2+zGlass.h*relativeY/(2*zoomArea.h))+'px';}
function step6(zoomWindowLeft){}
function step7(zoomWindowTop){}
function step8(){imageZoom.style.visibility='visible';}
function step9(){imageZoomFrame.style.visibility='visible';}
function step10(){imageZoom.onclick=function(){window.open(imageZoomImage.src,imageZoomImage.alt,'dependant = 1, fullscreen = 0, height = '+imageZoomImage.height+', width = '+imageZoomImage.width+', resizable = 1, status = 1');};}
function toggleInfo(){var popupinfo=document.getElementById("popupinfo");if(popupinfo.style.display=='block'){popupinfo.style.display='none';}else{popupinfo.style.border="1px solid #000";popupinfo.style.borderColor="#000";popupinfo.style.borderWidth="1px";popupinfo.style.borderStyle="solid";popupinfo.style.visibility="visible";popupinfo.style.display="block";popupinfo.style.border="3px solid #000";popupinfo.style.display='none';popupinfo.style.border="0px solid #000";popupinfo.style.borderColor="#000";popupinfo.style.borderWidth="1px";popupinfo.style.borderStyle="solid";popupinfo.style.display="block";popupinfo.style.borderColor="#000";popupinfo.style.borderWidth="1px";popupinfo.style.borderStyle="solid";popupinfo.style.border="1px solid #000";}
return false;}
function initAnimations(freq){if(typeof ts_animations=='undefined')
ts_animations={ticker:-1};if(typeof ts_animations.ticker=='undefined')
ts_animations.ticker=-1;if(!freq)var freq=120;var framelength=1.0/freq;ts_animations.tickerTime=Math.round(framelength*1000);if(navigator.appName=='Microsoft Internet Explorer'&&is_ie8()&&xp())return;ts_animations.ticker=setInterval(tick,ts_animations.tickerTime);}
function is_ie8(){if(new RegExp("Trident\/([0-9]+[\.0-9]*)").exec(navigator.userAgent)!=null){return parseFloat(RegExp.$1)==4;}
return false;}
function xp(){if(new RegExp("Windows NT ([0-9]+\.[0-9]*)").exec(navigator.userAgent)!=null){return RegExp.$1==5.1||RegExp.$1==5.2;}
return false;}
function tick(){emit('TS_ANIMATE_TICK');}
function initLeftRight(){if(typeof ts_animations=='undefined')ts_animations={ticker:-1};if(typeof ts_animations.leftright=='undefined')ts_animations.leftright={frames:frames,stepsLeft:0,active:firstShowingFrame,up:[],down:[],step:Math.round(width/20)};connect('TS_ANIMATE_TICK',leftright);}
function leftright(){if(typeof ts_animations=='undefined'||typeof ts_animations.leftright=='undefined')return;if(navigator.appName=='Microsoft Internet Explorer'&&is_ie8()&&xp())return;var step=ts_animations.leftright.step;var delUp=-1;var delDown=-1;for(var i=0;i<ts_animations.leftright.down.length;++i){ts_animations.leftright.down[i].width-=step;if(ts_animations.leftright.down[i].width<0)ts_animations.leftright.down[i].width=0;document.getElementById('frame'+ts_animations.leftright.down[i].no).style.width=ts_animations.leftright.down[i].width*frameSize+'px';var imgs=document.getElementById('frame'+ts_animations.leftright.down[i].no).childNodes;var a=ts_animations.leftright.down[i];for(var j=0;j<imgs.length;++j){var w=ts_animations.leftright.down[i].width;imgs[j].firstChild.firstChild.style.width=w+'px';imgs[j].style.width=(w-1<0?w:w-1)+'px';if(imgs[j].firstChild.nextSibling!=null)
imgs[j].firstChild.nextSibling.firstChild.style.width=w+'px';}
if(ts_animations.leftright.down[i].width<=0){document.getElementById('frame'+ts_animations.leftright.down[i].no).style.display='none';delDown=i;}}
for(var i=0;i<ts_animations.leftright.up.length;++i){ts_animations.leftright.up[i].width+=step;document.getElementById('frame'+ts_animations.leftright.up[i].no).style.width=ts_animations.leftright.up[i].width*frameSize+'px';var imgs=document.getElementById('frame'+ts_animations.leftright.up[i].no).childNodes;var a=ts_animations.leftright.up[i];for(var j=0;j<imgs.length;++j){var w=ts_animations.leftright.up[i].width;imgs[j].firstChild.firstChild.style.width=w+'px';imgs[j].style.width=(w-1<0?w:w-1)+'px';if(imgs[j].firstChild.nextSibling!=null)
imgs[j].firstChild.nextSibling.firstChild.style.width=w+'px';}
if(ts_animations.leftright.up[i].width>=width){delUp=i;}}
if(delUp>-1){ts_animations.leftright.up.splice(delUp,1);qdTurnOnTexts();}
if(delDown>-1){ts_animations.leftright.down.splice(delDown,1);qdTurnOnTexts();}}
function getChildrenOf(tmpImgs){var nodes=[];for(var tmp=0;tmp<tmpImgs.length;++tmp){nodes.push(tmpImgs[tmp].firstChild.firstChild);if(tmpImgs[tmp].lastChild.firstChild!=tmpImgs[tmp].firstChild.firstChild)nodes.push(tmpImgs[tmp].lastChild.firstChild);}
return nodes;}
function drop(frame){var tmpImgs=document.getElementById('frame'+(frame+framesToShow)).childNodes;var nodes=getChildrenOf(tmpImgs);setRGBA(nodes,255,255,255,0);document.getElementById('frame'+(frame+framesToShow)).style.display='block';document.getElementById('frame'+frame).style.display='none';fadeRGBA(nodes,{a:0},{a:255},1,80,'FRAME_DO_NOT_USE');}
function insert(frame){var tmpImgs=document.getElementById('frame'+(frame-framesToShow)).childNodes;var nodes=getChildrenOf(tmpImgs);setRGBA(nodes,255,255,255,0);document.getElementById('frame'+(frame-framesToShow)).style.display='block';fadeRGBA(nodes,{a:0},{a:255},1,80,'FRAME_DO_NOT_USE');}
function qdTurnOffTexts(){for(var i=0;i<document.getElementById('tsSweepStrip').childNodes.length;++i){for(var k=0;k<document.getElementById('tsSweepStrip').childNodes[i].childNodes.length;++k){var tmp=document.getElementById('tsSweepStrip').childNodes[i].childNodes[k];if(tmp==null)continue;for(var j=0;j<tmp.childNodes.length;++j){if(tmp.childNodes[j].childNodes.length!=3)return;tmp.childNodes[j].childNodes[1].style.visibility='hidden';tmp.childNodes[j].childNodes[2].style.visibility='hidden';}}}}
function qdTurnOnTexts(){for(var i=0;i<document.getElementById('tsSweepStrip').childNodes.length;++i){for(var k=0;k<document.getElementById('tsSweepStrip').childNodes[i].childNodes.length;++k){var tmp=document.getElementById('tsSweepStrip').childNodes[i].childNodes[k];if(tmp==null)continue;for(var j=0;j<tmp.childNodes.length;++j){if(tmp.childNodes[j].childNodes.length!=3)return;tmp.childNodes[j].childNodes[1].style.visibility='visible';tmp.childNodes[j].childNodes[2].style.visibility='visible';}}}}
function left(){if(typeof ts_animations=='undefined'||typeof ts_animations.leftright=='undefined')initLeftRight();if(navigator.appName=='Microsoft Internet Explorer'&&is_ie8()&&xp()){left_ie8();}else{var frame=ts_animations.leftright.active;if(frame==1)return;qdTurnOffTexts();document.getElementById('frame'+(frame-1)).style.display='block';document.getElementById('frame'+(frame-1)).style.width='0px';var imgs=document.getElementById('frame'+(frame-1)).childNodes;for(var j=0;j<imgs.length;++j){if(imgs[j].firstChild!=null&&imgs[j].firstChild.firstChild!=null)imgs[j].firstChild.firstChild.style.width='0px';}
ts_animations.leftright.up.push({no:frame-1,width:0,dir:'left'});ts_animations.leftright.down.push({no:frame+framesToShow-1,width:width,dir:'left'});}
--ts_animations.leftright.active;document.getElementById('arr_right').className='tsSweepArrow tsSweepArrowLink';document.getElementById('arr_right').onclick=right;if(ts_animations.leftright.active==1){document.getElementById('arr_left').className='tsSweepArrow tsSweepArrowNoLink';document.getElementById('arr_left').onclick='';}}
function right(){if(typeof ts_animations=='undefined'||typeof ts_animations.leftright=='undefined')initLeftRight();if(navigator.appName=='Microsoft Internet Explorer'&&is_ie8()&&xp()){right_ie8();}else{var frame=ts_animations.leftright.active;if(frame==ts_animations.leftright.frames-framesToShow+1)return;qdTurnOffTexts();ts_animations.leftright.up.push({no:frame+framesToShow,width:0,dir:'right'});ts_animations.leftright.down.push({no:frame,width:width,dir:'right'});document.getElementById('frame'+(frame+framesToShow)).style.display='block';document.getElementById('frame'+(frame+framesToShow)).style.width=3*width+'px';var imgs=document.getElementById('frame'+(frame+framesToShow)).childNodes;for(var j=0;j<imgs.length;++j){if(imgs[j].firstChild!=null&&imgs[j].firstChild.firstChild!=null)imgs[j].firstChild.firstChild.style.width=width+'px';}}
++ts_animations.leftright.active;document.getElementById('arr_left').className='tsSweepArrow tsSweepArrowLink';document.getElementById('arr_left').onclick=left;if(ts_animations.leftright.active==ts_animations.leftright.frames-framesToShow+1){document.getElementById('arr_right').className='tsSweepArrow tsSweepArrowNoLink';document.getElementById('arr_right').onclick='';}}
function left_ie8(){if(typeof ts_animations=='undefined'||typeof ts_animations.leftright=='undefined')return;var frame=ts_animations.leftright.active;if(frame==1)return;var tmpImgs=document.getElementById('frame'+(frame+framesToShow-1)).childNodes;unconnect('FADE_IS_DONE_FRAME'+(frame+framesToShow-1));connect('FADE_IS_DONE_FRAME'+(frame+framesToShow-1),function(){insert(frame+framesToShow-1);});var nodes=getChildrenOf(tmpImgs);fadeRGBA(nodes,{r:255,g:255,b:255,'a':255},{r:255,g:255,b:255,'a':0},0.4,80,'frame'+(frame+framesToShow-1));}
function right_ie8(){if(typeof ts_animations=='undefined'||typeof ts_animations.leftright=='undefined')return;var frame=ts_animations.leftright.active;if(frame==ts_animations.leftright.frames-framesToShow+1)return;var tmpImgs=document.getElementById('frame'+frame).childNodes;unconnect('FADE_IS_DONE_FRAME'+frame);connect('FADE_IS_DONE_FRAME'+frame,function(){drop(frame);});var nodes=getChildrenOf(tmpImgs);fadeRGBA(nodes,{r:255,g:255,b:255,'a':255},{r:255,g:255,b:255,'a':0},0.4,80,'frame'+frame);}
function showName(id){var div=document.createElement('DIV');div.style.filter='alhpa(opacity=60)';div.style.opacity='0.6';div.style.backgroundColor='#ddd';div.style.fontSize='0.8em';div.style.color='#000';div.style.textDecoration='none';div.style.textAlign='center';div.style.position='absolute';div.style.bottom='0px';div.style.left='0px';div.style.width='100%';div.innerHTML=document.getElementById('linkTo'+id).firstChild.firstChild.alt;document.getElementById('linkTo'+id).firstChild.appendChild(div);}
function hideName(id){document.getElementById('linkTo'+id).firstChild.removeChild(document.getElementById('linkTo'+id).firstChild.lastChild);}
function hoverIn(elem){elem.lastChild.className='tsSweepNameOverlayShow';}
function hoverOut(elem){elem.lastChild.className='tsSweepNameOverlay';}
function flip(){var str=cinemaImage.src;var char='f';if(str.substr(str.length-5,1)=='f'){char='b';}
cinemaImage.src=str.substr(0,str.length-5)+char+'.jpg';var str=imageZoomImage.src;imageZoomImage.src=str.substr(0,str.length-5)+char+'.jpg';}
function trim(s){return ltrim(rtrim(s));}function ltrim(s){return s.replace(/^\\s+/g,'');}function rtrim(s){return s.replace(/\\s+$/g,'');}
function qdSetCookie(path,domain){var measText=encodeURIComponent(trim(document.getElementById('measDropDown'+'_text_'+1).innerHTML));var expires=new Date();expires.setTime(expires.getTime()+1000*60*60*6);var monogram=document.getElementById('subproduct_attribute_29_3')==null?'':document.getElementById('subproduct_attribute_29_3').value;var frmModel=document.getElementById('template_form').frmModel?document.getElementById('template_form').frmModel:document.getElementById('template_form').attribute_7;var fit=frmModel.value?(frmModel.value==2||frmModel.value==42?'normal':(frmModel.value==1||frmModel.value==43?'slim':'unknown')):'unknown';var value='monogram='+monogram
+'&fit='+fit
+'&smeas='+document.getElementById('frmSmeas').value
+'&mprofile='+document.getElementById('frmMprofile').value
+'&meastext='+measText;document.cookie="qd="+escape(value)+";expires="+expires.toGMTString()+";path="+(path?path:"/")+";domain"+(domain?domain:"www.tailorstore.");}
function removeElement(elem){elem.parentNode.removeChild(elem);}
function checkPiqueQdMp(){try{var activeSizeSelectBox=null;if(document.getElementById('frmSmeas').value==0&&document.getElementById('frmMprofile').value>0){var url=customPiqueUrl+'/check_meas/'+document.getElementById('frmMprofile').value+'?type='+productType;eval(sjaxCall(url,'GET'));}else{return true;}}catch(err){logError(errorLogUrl,err,'checkMp()');return false;}
return checkSuccessful;}
function done(){var node=document.getElementById('tsSweepStrip').firstChild;while((node=node.nextSibling)!=null){for(var i=0;i<node.childNodes.length;++i){node.childNodes[i].className='tsSweepElementContainer';var regexp=new RegExp("(\\d+)-(\\d+)stripimage","i");var matches=regexp.exec(node.childNodes[i].firstChild.firstChild.id);var tmpGroup=matches[1];var tmpProduct=matches[2];if(tmpGroup==selectedGroup)node.childNodes[i].className+=' tsSweepElementContainerSelectedGroup';if(tmpGroup==selectedGroup&&tmpProduct==selectedProduct)node.childNodes[i].className+=' tsSweepElementContainerSelectedProduct';}}
cinemaImage=document.getElementById('cinema');if(cinemaImage!=null){document.getElementById('cinema').onmouseover=zoomInit;imagePos=findPos(cinemaImage);}
changeFabric();if(!checkValidityOfMeasurements(false)){document.getElementById('frmMprofile').value=0;combobox_set_value('measDropDown',0);}}
function reloadAjax(href){window.location.href=/(^#*)#?/.exec(window.location.href)[1]+"#"+href;var matches=new RegExp("/[-a-z_]+/(\\d+)/(\\d+)","i").exec(href);selectedGroup=matches[1];selectedProduct=matches[2];loadInnerHTMLCallback(document.getElementById('mid-area'),href,done);return false;}
if(window.location.hash.length>10){reloadAjax(window.location.hash.substring(1,window.location.hash.length)+((window.location.hash.substring(window.location.hash.length-12,window.location.hash.length)!='?isajax=true')?'?isajax=true':''));}
var cinemaImage=document.getElementById('cinema');if(cinemaImage!=null){document.getElementById('cinema').onmouseover=zoomInit;var imagePos=findPos(cinemaImage);}
var imageZoom;var imageZoomImage;var imageZoomFrame;initAnimations(80);if(typeof(firstShowingFrame)!='undefined')initLeftRight();
function showHideExtendedDescription(cartIndex){var extendImage=document.getElementById('extended_description_img_'+cartIndex);var extendedInfoDiv=document.getElementById('extended_description_'+cartIndex);if(extendedInfoDiv.style.display=='none'){extendedInfoDiv.style.display='block';extendImage.src='/media/gfx/ball_smallquestion_pressed.gif';}else{extendedInfoDiv.style.display='none';extendImage.src='/media/gfx/ball_smallquestion.gif';}}
function doPostSubmit(submitPage,formId){var postString="";var form=document.getElementById(formId);for(var i=0;i<form.elements.length;i++){if(i<form.elements.length&&i>0)postString+='&';var element=form.elements[i];if(element.value==''&&element.required=='required'){alert('Value for \''+element.name+'\' must be set!');return false;}
if(element.type=='checkbox'&&element.checked!=1){}else if(element.type=='radio'&&element.checked!=1){}else{postString+=element.name+'='+escape(element.value);}}
simplePostAjaxCall(submitPage,postString);}
function doSynchronousPostSubmit(submitPage,formId){var postString="";var form=document.getElementById(formId);for(var i=0;i<form.elements.length;i++){if(i<form.elements.length&&i>0)postString+='&';var element=form.elements[i];if(element.value==''&&element.required=='required'){alert('Value for \''+element.name+'\' must be set!');return false;}
if(element.type=='checkbox'&&element.checked!=1){}else if(element.type=='radio'&&element.checked!=1){}else{postString+=element.name+'='+escape(element.value);}}
return simplePostSjaxCall(submitPage,postString);}
function simplePostSjaxCall(page,postString){var xmlhttp=false;try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(E){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
xmlhttp.open('POST',page,false);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.send(postString);return xmlhttp.responseText;}
function simplePostAjaxCall(page,postString){var xmlhttp=false;try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(E){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
xmlhttp.open('POST',page,true);xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");xmlhttp.setRequestHeader("Content-length",postString.length);xmlhttp.setRequestHeader("Connection","close");xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==1){}else if(xmlhttp.readyState==4){var content=xmlhttp.responseText;}}
xmlhttp.send(postString)
return;}
function ajaxCall(page){var xmlhttp=false;try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(E){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
xmlhttp.open('GET',page,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==1){}else if(xmlhttp.readyState==4){var content=xmlhttp.responseText;eval(content);}}
xmlhttp.send(null)
return;}
function ajaxPost(page,params){var xmlhttp=false;try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(E){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
xmlhttp.open('POST',page);xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==1){}else if(xmlhttp.readyState==4){var content=xmlhttp.responseText;eval(content);}}
xmlhttp.send(params);return;}
function loadInnerHTMLWithFormSubmitResult(obj,submitPage,formId){var postString="";var form=document.getElementById(formId);for(var i=0;i<form.elements.length;i++){if(i<form.elements.length&&i>0)postString+='&';var element=form.elements[i];if(element.value==''&&element.required=='required'){alert('Value for \''+element.name+'\' must be set!');return false;}
if(element.type=='checkbox'&&element.checked!=1){}else if(element.type=='radio'&&element.checked!=1){}else{postString+=element.name+'='+escape(element.value);}}
var xmlhttp=false;try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(err){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
xmlhttp.open('POST',submitPage);xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==1){}else if(xmlhttp.readyState==4){if(isArray(obj)){for(el in obj){element=obj[el];element.innerHTML=xmlhttp.responseText;}}else obj.innerHTML=xmlhttp.responseText;}}
xmlhttp.send(postString)}
function postCallback(submitPage,formId,callback){var postString="";var form=document.getElementById(formId);for(var i=0;i<form.elements.length;i++){if(i<form.elements.length&&i>0)postString+='&';var element=form.elements[i];if(element.value==''&&element.required=='required'){alert('Value for \''+element.name+'\' must be set!');return false;}
if(element.type=='checkbox'&&element.checked!=1){}else if(element.type=='radio'&&element.checked!=1){}else{postString+=element.name+'='+escape(element.value);}}
var xmlhttp=false;try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(err){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
xmlhttp.open('POST',submitPage);xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.onreadystatechange=function(){xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==1){}else if(xmlhttp.readyState==4){callback(xmlhttp.responseText);}}}
xmlhttp.send(postString)}
function getCallback(submitPage,formId,callback,postString){var postString=postString!=null?postString:'';var form=document.getElementById(formId);for(var i=0;i<form.elements.length;i++){var element=form.elements[i];if(element.value==''&&element.required=='required'){alert('Value for \''+element.name+'\' must be set!');return false;}
if(element.type=='checkbox'){if(postString.length>0)
postString+='&';if(element.checked)
postString+=element.name+'=1';else
postString+=element.name+'=0';}else if(element.type=='radio'&&element.checked!=1){}else{if(postString.length>0)
postString+='&';postString+=element.name+'='+escape(element.value);}}
var xmlhttp=false;try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(err){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
xmlhttp.open('GET',submitPage+'?'+postString,true);xmlhttp.onreadystatechange=function(){xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==1){}else if(xmlhttp.readyState==4){callback(xmlhttp.responseText);}}}
xmlhttp.send(null)}
function loadInnerHTML(obj,cmd){var xmlhttp=false;try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(err){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
xmlhttp.open('GET',cmd,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==1){}else if(xmlhttp.readyState==4){obj.innerHTML=xmlhttp.responseText;}}
xmlhttp.send(null)}
function simpleCallback(cmd,callback){var xmlhttp=false;try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(err){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
xmlhttp.open('GET',cmd,true);xmlhttp.onreadystatechange=function(){xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==1){}else if(xmlhttp.readyState==4){callback(xmlhttp.responseText);}}}
xmlhttp.send(null)}
function loadInnerHTMLCallback(obj,cmd,callback,js){var xmlhttp=false;try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(E){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
xmlhttp.open('GET',cmd,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==1){}else if(xmlhttp.readyState==4){if(js&&xmlhttp.responseText.lastIndexOf('@@@')>=0){obj.innerHTML=xmlhttp.responseText.substring(xmlhttp.responseText.lastIndexOf('@@@')+3);callback(xmlhttp.responseText);}else{obj.innerHTML=xmlhttp.responseText;callback();}}}
xmlhttp.send(null)}
function getStackTrace(){var callstack=[];var isCallstackPopulated=false;try{i.dont.exist+=0;}catch(e){if(e.stack){var lines=e.stack.split("\n");for(var i=0,len=lines.length;i<len;i++){if(lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)){callstack.push(lines[i]);}}
callstack.shift();isCallstackPopulated=true;}
else if(window.opera&&e.message){var lines=e.message.split("\n");for(var i=0,len=lines.length;i<len;i++){if(lines[i].match(/^\s*[A-Za-z0-9\-_\$]+\(/)){var entry=lines[i];if(lines[i+1]){entry+=" at "+lines[i+1];i++;}
callstack.push(entry);}}
callstack.shift();isCallstackPopulated=true;}}
if(!isCallstackPopulated){var currentFunction=arguments.callee.caller;while(currentFunction){var fn=currentFunction.toString();var fname=fn.substring(fn.indexOf("function")+8,fn.indexOf("("))||"anonymous";callstack.push(fname);currentFunction=currentFunction.caller;}}
return callstack;}
function logError(loggingPage,error,functionName){var parameters="function_name="+functionName;for(var i in error){parameters+="&"+i+"="+escape(error[i]);}
if(parameters.indexOf("message")==-1)parameters+="&message="+escape(error.message);parameters+="&browser="+escape(navigator.userAgent);stacktrace=getStackTrace();parameters+="&stacktrace="+escape(stacktrace.join('\r\n'));var xmlhttp=false;try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(E){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
xmlhttp.open('POST',loggingPage,true);xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState==4){return;}};xmlhttp.send(parameters);}
function sjaxCall(url,request){try{xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(E){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){xmlhttp=new XMLHttpRequest();}
var mode=request?"POST":"GET";xmlhttp.open(mode,url,false);if(mode=="POST"){xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}
xmlhttp.send(request);return xmlhttp.responseText;}
function isArray(obj){if(obj instanceof Array)return true;else return false;}
var supportedCharacters=" 1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzÀÁÂÃÄÅÆÈÉÕÖØÙÜßàáâãäåæàáâãäåæõöøùü&-.,";function checkEmbroideryCharacters(id){var embroideryTextCtrl=document.getElementById(id);var embroideryText=embroideryTextCtrl.value;var newEmbroideryText="";for(var i=0;i<embroideryText.length;i++){character=embroideryText.charAt(i);if(supportedCharacters.indexOf(character)>-1){newEmbroideryText+=character;embroideryTextCtrl.value=newEmbroideryText.toUpperCase();}else{alert(str_replace(document.getElementById('lang_notpermitted').innerHTML,"%t",character));embroideryTextCtrl.value=newEmbroideryText;return;}}}
function str_replace(haystack,needle,replacement){var temp=haystack.split(needle);return temp.join(replacement);}
function simple_var_dump(arr,level){var dumped_text="";if(!level)level=0;var level_padding="";for(var j=0;j<level+1;j++)level_padding+="    ";if(typeof(arr)=='object'){arr.forEach(function(value,item,arr){if(typeof(value)=='object'){dumped_text+=level_padding+"'"+item+"' ...\n";dumped_text+=dump(value,level+1);}else{dumped_text+=level_padding+"'"+item+"' => \""+value+"\"\n";}});}else{dumped_text="===>"+arr+"<===("+typeof(arr)+")";}
return dumped_text;}
function showModalPopup(url,width,height,left,top){var width=width!=null&&width>0?width:800;var height=height!=null&&height>0?height:600;var left=left!=null&&left>0?left:0;var top=top!=null&&top>0?top:0;popup('modalWidget','',width,height,false,left,top);var contentObject=document.getElementById('modalWidgetContent');loadInnerHTML(contentObject,url);}
function updateModalPopup(url,width,height,left,top){if(activePopupId=='modalWidget'){if(ie6){killPopup();showModalPopup(url,width,height,left,top);return;}
var popupContent=document.getElementById('modalWidgetContent');loadInnerHTMLCallback(popupContent,url,function(){var popup=document.getElementById('popup_'+activePopupId);popupContent.style.width=width+'px';popupContent.style.height=height+'px';var size=getBrowserSize();var browserWidth=size[0];var browserHeight=size[1];var st=Math.max(document.body.scrollTop,document.documentElement.scrollTop);var sl=Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);var left=left!=null&&left>0?left:browserWidth/2-width/2+sl;var top=top!=null&&top>0?top:browserHeight/2-height/2+st;popup.style.left=left+'px';popup.style.top=top+'px';});}}
var activePopupId=0;function getBrowserSize(){var bodyWidth=document.documentElement.clientWidth;var bodyHeight=document.documentElement.clientHeight;var bodyWidth,bodyHeight;if(self.innerHeight){bodyWidth=self.innerWidth;bodyHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){bodyWidth=document.documentElement.clientWidth;bodyHeight=document.documentElement.clientHeight;}else if(document.body){bodyWidth=document.body.clientWidth;bodyHeight=document.body.clientHeight;}
return[bodyWidth,bodyHeight];}
function popup(id,html,width,height,closeAction,left,top){activePopupId=id;var closeAction=closeAction!=null&&closeAction?closeAction:function(){killPopup(id);};if(ie6){return ie6_popup(id,html,width,height,closeAction,left,top);}
var popupMaster=document.createElement('div');var h=Math.max(Math.max(Math.max(typeof document.body.clientHeight=='number'?document.body.clientHeight:0,typeof document.documentElement.clientHeight=='number'?document.documentElement.clientHeight:0),Math.max(typeof document.documentElement.scrollHeight=='number'?document.documentElement.scrollHeight:0,typeof document.body.scrollHeight=='number'?document.body.scrollHeight:0)),Math.max(Math.max(typeof document.documentElement.offsetHeight=='number'?document.documentElement.offsetHeight:0,typeof document.body.offsetHeight=='number'?document.body.offsetHeight:0),Math.max(typeof document.documentElement.height=='number'?document.documentElement.height:0,typeof document.body.height=='number'?document.body.height:0)));var w=Math.max(Math.max(Math.max(typeof document.body.clientWidth=='number'?document.body.clientWidth:0,typeof document.documentElement.clientWidth=='number'?document.documentElement.clientWidth:0),Math.max(typeof document.documentElement.scrollWidth=='number'?document.documentElement.scrollWidth:0,typeof document.body.scrollWidth=='number'?document.body.scrollWidth:0)),Math.max(Math.max(typeof document.documentElement.offsetWidth=='number'?document.documentElement.offsetWidth:0,typeof document.body.offsetWidth=='number'?document.body.offsetWidth:0),Math.max(typeof document.documentElement.width=='number'?document.documentElement.width:0,typeof document.body.width=='number'?document.body.width:0)));var size=getBrowserSize();var browserWidth=size[0];var browserHeight=size[1];var st=Math.max(document.body.scrollTop,document.documentElement.scrollTop);var sl=Math.max(document.body.scrollLeft,document.documentElement.scrollLeft);var left=left!=null&&left>0?left:browserWidth/2-width/2+sl;var top=top!=null&&top>0?top:browserHeight/2-height/2+st;popupMaster.style.height=h+'px';popupMaster.style.width=w+"px";popupMaster.className='popupMaster';if(id)popupMaster.id=id;var popupMasterBg=document.createElement('div');popupMasterBg.onclick=closeAction;popupMasterBg.style.width=w+'px';popupMasterBg.style.height=h+'px';popupMasterBg.className='popupMasterBG';popupMasterBg.style.filter='alpha(opacity=50)';var popup=document.createElement('div');var popupContent=document.createElement('div');popup.appendChild(popupContent);if(id)popup.id='popup_'+id;if(html)popupContent.innerHTML=html;if(id)popupContent.id=id+'Content';if(width)popupContent.style.width=width+'px';if(height)popupContent.style.height=height+'px';popup.className='popup';popup.style.left=left+"px";popup.style.top=top+"px";popup.style.marginLeft="0px";popup.style.marginTop="0px";popupMaster.innerHTML=' &nbsp; ';popupMaster.appendChild(popupMasterBg);if(document.documentElement&&document.documentElement.appendchild){document.documentElement.appendChild(popupMaster);document.documentElement.appendChild(popup);}else{document.body.appendChild(popupMaster);document.body.appendChild(popup);}}
function killPopup(id){var id=id!=null?id:activePopupId;try{document.documentElement.removeChild(document.getElementById(id));document.documentElement.removeChild(document.getElementById('popup_'+id));}catch(error){try{document.body.removeChild(document.getElementById(id));document.body.removeChild(document.getElementById('popup_'+id));}catch(error2){}}}
function getPageWidthWithoutScrollBars(){return document.documentElement.clientWidth;}
function getPageHeightWithoutScrollBars(){return document.documentElement.clientHeight;}
function connect(signal,receiver){if(typeof signals!='object')signals=[];if(typeof signals[signal]!='object'||!(signals[signal]instanceof Array)){signals[""+signal]=new Array();}
signals[""+signal].push(receiver);}
function emit(signal,wait){if(typeof signals!='object')signals=[];if(!wait){var wait=0;}
if(typeof signals[signal]=='undefined'||signals[signal]==null){return;}
signals[signal].forEach(function(receiverElement,receiver,receiverArray){if(wait>0)setTimeout(receiverElement,wait);else if(receiverArray.length==1){receiverElement();}else{setTimeout(receiverElement,wait);}});debug(signal+' is fired with wait: '+wait);}
function unconnect(signal,receiver){if(typeof signals!='object')signals=[];if(typeof(signals[signal])!='object'&&!(signals[signal]instanceof Array))
return;if(!receiver)
delete signals[signal];else
for(var i=0;i<signals[signal].length;++i)
if(signals[signal][i]==receiver)
signals[signal].splice(signals[signal][i]);}
var TsEvent={addListener:function(elem,event,func){if(event.substr(0,2)=='on')
event=event.substr(2);if(elem.attachEvent){elem['e'+event+func]=func;elem[event+func]=function(){elem['e'+event+func](window.event);}
elem.attachEvent('on'+event,elem[event+func]);}else
elem.addEventListener(event,func,false);},removeListener:function(elem,event,func){if(event.substr(0,2)=='on')
event=event.substr(2);if(elem.detachEvent){elem.detachEvent('on'+event,elem[event+func]);elem[event+func]=null;}else
elem.removeEventListener(event,func,false);}};function findPos(obj){var xy={x:0,y:0};if(obj.offsetParent){do{xy.x+=obj.offsetLeft;xy.y+=obj.offsetTop;}while(obj=obj.offsetParent);}return xy;}
function getWidthHeight(obj){if(obj.naturalHeight&&obj.naturalWidth>0)return{width:obj.naturalWidth,height:obj.naturalHeight};if(obj.width&&obj.width>0)return{width:obj.width,height:obj.height};if(obj.getAttribute&&obj.getAttribute('width')>0)return{width:obj.getAttribute('width'),height:obj.getAttribute('height')};if(obj["width"]&&obj["width"]>0)return{width:obj["width"],height:obj["height"]};return{width:0,height:0};}
function getMouseXY(e){if(!e)var e=window.event;var xy={x:0,y:0};xy.x=e.pageX||e.pageY?e.pageX:e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)-(document.documentElement.clientLeft||0);xy.y=e.pageX||e.pageY?e.pageY:e.clientY+(document.documentElement.scrollTop||document.body.scrollTop)-(document.documentElement.clientTop||0);return xy;}
function BackgroundThread(name){this.name=name;this.backgroundStep1=0;this.backgroundStep2=0;this.backgroundInstructions=[];this.tmp=0;this.pause=10;this.length=50;this.enqueue=function(){this.backgroundInstructions[this.backgroundInstructions.length]=arguments;};this.process=function(callback){var time=new Date();time=time.getMilliseconds()+time.getSeconds()*1000+time.getMinutes()*60*1000+time.getHours()*60*60*1000;var btime=new Date();btime=btime.getMilliseconds()+btime.getSeconds()*1000+btime.getMinutes()*60*1000+btime.getHours()*60*60*1000;while(btime-time<this.length&&this.tmp<this.backgroundInstructions.length){var args=[];for(var i=2;i<this.backgroundInstructions[this.tmp].length;++i)args[args.length]=this.backgroundInstructions[this.tmp][i];this.backgroundInstructions[this.tmp][1].apply(this.backgroundInstructions[this.tmp][0],args);this.tmp++;btime=new Date();btime=btime.getMilliseconds()+btime.getSeconds()*1000+btime.getMinutes()*60*1000+btime.getHours()*60*60*1000;}
if(this.tmp>=this.backgroundInstructions.length){emit('BACKGROUND_PROCESSING_IS_DONE_'+name.toUpperCase());return;}else{emit('BACKGROUND_PROCESSING_TICK_'+name.toUpperCase());var tmpObject=this;setTimeout(function(){tmpObject.process();},this.pause);}};this.status=function(){return Math.round(100*this.tmp/this.backgroundInstructions.length);};}
ts_animations={freqs:{}};function initEasing(frequenzy,duration){if(!ts_animations)ts_animations={freqs:{}};if(!ts_animations.freqs)ts_animations.freqs={};if(ts_animations.freqs['a'+frequenzy+'-'+duration])return;var frames=Math.round(duration*frequenzy);var midpoint=(frames/2)+1;var ticks=[];ts_animations.freqs['a'+frequenzy+'-'+duration]=[];ts_animations.freqs['b'+frequenzy+'-'+duration]=[];var totSum=0;for(var i=1;i<=frames;++i){ticks.push(Math.sin(Math.PI*i/midpoint));ts_animations.freqs['a'+frequenzy+'-'+duration].push((i==1?0:ts_animations.freqs['a'+frequenzy+'-'+duration][i-2])+ticks[i-1]);totSum+=ts_animations.freqs['a'+frequenzy+'-'+duration][i-1];}var tmp=0;for(var i=0;i<frames;++i){ts_animations.freqs['a'+frequenzy+'-'+duration][i]=ts_animations.freqs['a'+frequenzy+'-'+duration][i]/totSum;tmp+=ts_animations.freqs['a'+frequenzy+'-'+duration][i];ts_animations.freqs['b'+frequenzy+'-'+duration].push(tmp);}}
function fadeRGBA(node,from,to,duration,freq,name,changeFunc,behaviour){if(!behaviour)
var behaviour=TS_BEHAVIOUR_PULSE;if(!changeFunc)
var changeFunc=setRGBA;if(!freq)
var freq=60;if(!duration)
var duration=0.25;switch(behaviour){case TS_BEHAVIOUR_STRAIGHT:break;case TS_BEHAVIOUR_MIX:break;case TS_BEHAVIOUR_PULSE:default:initEasing(freq,duration);break;}
var framelength=1/freq;var time=duration;var millitime=time*1000.0;var frames=Math.round(time*freq);var milliframelength=millitime/frames;if(from.length){from={'r':from.length>0?from[0]:-1,'g':from.length>1?from[1]:-1,'b':from.length>2?from[2]:-1,'a':from.length>3?from[3]:-1}}else{if(!from.r)
from.r=-1;if(!from.g)
from.g=-1;if(!from.b)
from.b=-1;if(!from.a)
from.a=-1;}
if(to.length){to={'r':to.length>0?to[0]:-1,'g':to.length>1?to[1]:-1,'b':to.length>2?to[2]:-1,'a':to.length>3?to[3]:-1}}else{if(!to.r)
to.r=-1;if(!to.g)
to.g=-1;if(!to.b)
to.b=-1;if(!to.a)
to.a=-1;}
var distance={r:to.r-from.r,g:to.g-from.g,b:to.b-from.b,a:to.a-from.a};var r=0,g=0,b=0,a=0;var oldR=-2;var oldG=-2;var oldB=-2;var oldA=-2;for(var i=0;i<frames;++i){switch(behaviour){case TS_BEHAVIOUR_STRAIGHT:r=Math.round(distance.r*i/frames+from.r);g=Math.round(distance.g*i/frames+from.g);b=Math.round(distance.b*i/frames+from.b);a=Math.round(distance.a*i/frames+from.a);break;case TS_BEHAVIOUR_MIX:break;case TS_BEHAVIOUR_PULSE:default:r=Math.round(distance.r*ts_animations.freqs['b'+freq+'-'+duration][i]+from.r);g=Math.round(distance.g*ts_animations.freqs['b'+freq+'-'+duration][i]+from.g);b=Math.round(distance.b*ts_animations.freqs['b'+freq+'-'+duration][i]+from.b);a=Math.round(distance.a*ts_animations.freqs['b'+freq+'-'+duration][i]+from.a);break;}
if(oldR==r&&oldG==g&&oldB==b&&oldA==a)continue;oldR=r;oldG=g;oldB=b;oldA=a;var f=function temporaryFunction(){var func=createFunction(changeFunc,node,r,g,b,a);var isAtEndFunc=createFunction(isAtEnd,i,frames,name);setTimeout(function(){func();isAtEndFunc();},Math.round(milliframelength*i));};f();}}
var superI=0;function createFunction(){var func=arguments[0];var args=[];for(var i=1;i<arguments.length;++i)args[args.length]=arguments[i];return function createdFunction(){func.apply(window,args);}}
function isAtEnd(i,frames,name){if(i==frames-2)emit('FADE_IS_DONE_'+name.toUpperCase());}
var stupidGeckoFader={};function setRGBA(node,r,g,b,a){if(typeof node!='array'&&!node.length)
node=[node];for(var i=0;i<node.length;++i){if(a>-1){node[i].style.opacity=a/255;node[i].style.MozOpacity=a/255;node[i].style.KhtmlOpacity=a/255;node[i].style.filter="alpha(opacity="+100*a/255+")";}
if(r>-1&&g>-1&&b>-1)
node[i].style.backgroundColor='rgb('+r+','+g+','+b+')';}}
function setBorderRGB(node,r,g,b){if(arguments.length==2&&typeof arguments[1]=='array'){var r=arguments[1].length>=1?arguments[1][0]:255;var g=arguments[1].length>=2?arguments[1][1]:255;var b=arguments[1].length>=3?arguments[1][2]:255;}else if(arguments.length==2&&typeof arguments[1]=='object'){var r=typeof arguments[1].r!='undefined'?arguments[1].r:255;var g=typeof arguments[1].g!='undefined'?arguments[1].g:255;var b=typeof arguments[1].b!='undefined'?arguments[1].b:255;}
if(typeof node!='array'&&!node.length)
node=[node];for(var i=0;i<node.length;++i){node[i].style.border='2px solid rgb('+r+','+g+','+b+')';}}
function setTextRGB(node,r,g,b){if(typeof node!='array'&&!node.length)
node=[node];for(var i=0;i<node.length;++i){node[i].style.color='rgb('+r+','+g+','+b+')';}}
var TS_BEHAVIOUR_PULSE=1;var TS_BEHAVIOUR_STRAIGHT=2;var TS_BEHAVIOUR_MIX=3;function fadeLoop(node,stops,duration,freq,name,func,behaviour){if(!behaviour)
var behaviour=TS_BEHAVIOUR_PULSE;if(!freq)
var freq=45;if(!duration)
var duration=0.3;if(!name)
var name='FADELOOP';if(!func)
var func=setRGBA;var steps=stops.length-1;for(var i=0;i<steps;++i){if(i==0){fadeRGBA(node,stops[i],stops[i+1],duration/steps,freq,name,func,behaviour);}else{var f=function temporaryFunction(){var fadeFunc=createFunction(fadeRGBA,node,stops[i],stops[i+1],duration/steps,freq,name,func,behaviour);setTimeout(function(){fadeFunc();},Math.round(duration/steps*i*1000));};f();}}}
var firstTimeMainview=true;var disableFades=false;function fadeIn(node,duration,freq,name){if(!freq)
var freq=45;if(!duration)
var duration=0.3;if(!name)
var name='FADEIN';if(name=='MAINVIEW'&&firstTimeMainview){firstTimeMainview=false;connect('FADE_IS_DONE_MAINVIEW',gaugeFadeIn);gaugingFade=new Date().getTime();}
if(disableFades){changeOpac(node,100);emit('FADE_IS_DONE_'+name.toUpperCase());}else{fadeRGBA(node,{a:0},{a:255},duration,freq,name);}}
function gaugeFadeIn(){firstTimeMainview=false;unconnect('FADE_IS_DONE_MAINVIEW');if(new Date().getTime()-gaugingFade>230){debug('DISABLING FADE!!!');disableFades=true;}}
function fadeOut(node,duration,freq,name){if(!freq)
var freq=45;if(!duration)
var duration=0.3;if(!name)
var name='FADEOUT';fadeRGBA(node,{a:255},{a:0},duration,freq,name);}
function changeOpac(obj,opacity){var opVal=opacity/100;obj.style.opacity=opVal;obj.style.MozOpacity=opVal;obj.style.KhtmlOpacity=opVal;obj.style.filter="alpha(opacity="+opacity+")";}
function debug(str){if(typeof(allowDebug)==='undefined'||!allowDebug)return;if(typeof(debugArea)==='undefined'){debugTime=new Date().getTime();debugCounter=0;debugArea=document.createElement('DIV');debugArea.style.textAlign='left';debugArea.style.zIndex='6000';debugArea.style.backgroundColor='#ffc';debugArea.style.position='fixed';debugArea.style.bottom='0';debugArea.style.right='0';debugArea.style.width='50px';debugArea.style.verticalAlign='bottom';debugArea.style.borderTop='1px dashed #000';debugArea.style.borderLeft='1px dashed #000';debugStatus=false;showHideDebug();debugTitle=document.createElement('P');debugTitle.appendChild(document.createTextNode('Debug'));debugTitle.style.position='fixed';debugTitle.style.bottom='0px';debugTitle.style.right='0px';debugTitle.style.textAlign='right';debugTitle.style.width='5em';debugTitle.style.borderTop='2px solid black';debugTitle.style.borderLeft='2px solid black';debugTitle.style.backgroundColor='#ffc';debugTitle.style.cursor='pointer';debugTitle.style.marginTop='0';debugTitle.style.marginBottom='0';debugTitle.onclick=showHideDebug;debugContent=document.createElement('DIV');debugArea.appendChild(debugTitle);debugArea.appendChild(debugContent);document.body.appendChild(debugArea);}
var debugLine=document.createElement('P');debugLine.appendChild(document.createTextNode('['+(new Date().getTime()-debugTime)+' ms] '));debugLine.appendChild(document.createTextNode(str));debugLine.style.marginTop='0';debugLine.style.borderTop='1px dotted #999';debugLine.style.backgroundColor='#ff9';debugLine.id='debugLine'+(++debugCounter);debugContent.appendChild(debugLine);}
function showHideDebug(){if(debugStatus){debugArea.style.height='1em';debugArea.style.width='50px';debugArea.style.overflow='hidden';debugArea.style.borderTop='1px dashed #000';}else{debugArea.style.height='100%';debugArea.style.width='350px';debugArea.style.overflow='scroll';debugArea.style.borderTop='0';}debugStatus=!debugStatus;}