
var activemenu;function loadInitialZoomWindow(responseText){if(responseText){var pos1=responseText.indexOf('@@@');var pos2=responseText.lastIndexOf('@@@');if(pos1>=0&&pos2>0&&pos1<pos2&&pos1<responseText.length){var str2=responseText.substring(pos1+3,pos2);if(updateZoom){str2=str2.split('\t');if(str2.length==3)
updateZoom([3,str2[0],str2[1],str2[2]]);else
updateZoom([3,str2[0],str2[1],'']);}else{eval(str2);}}}}
function go(flow,step){if(!step)var step=designerState.last[flow];if(designerState.active.flow!=flow){var flowmenu=document.getElementById('flownav');var menuitems=flowmenu.getElementsByTagName('li');if(menuitems[designerState.active.flow-1])menuitems[designerState.active.flow-1].className='prev';menuitems[flow-1].className='active';}
if(designerState.active.flow!=flow){if(document.getElementById('lb_'+designerState.active.flow))document.getElementById('lb_'+designerState.active.flow).style.display='none';document.getElementById('lb_'+flow).style.display='block';}
document.getElementById('b_'+flow+'_'+designerState.last[flow]).className='';document.getElementById('b_'+flow+'_'+step).className='selected';if(document.getElementById('p_'+designerState.active.flow+'_'+designerState.active.step))document.getElementById('p_'+designerState.active.flow+'_'+designerState.active.step).style.visibility='hidden';if(!designerState.loaded[flow][step]){document.getElementById('p_'+flow+'_'+step).innerHTML='<div style="width:100%;height:640px;position:absolute;overflow:hidden;left:0px;"><img src="/media/gfx/ui/loading.gif" alt="" class="ts_loading" /></div>';loadInnerHTMLCallback(document.getElementById('p_'+flow+'_'+step),designerState.callBackUrl+'/fill/'+flow+'-'+step,function(responseText){loadInitialZoomWindow(responseText);loadNext(flow,step)},true);designerState.loaded[flow][step]=1;}else{getCallback(designerState.callBackUrl+'/update/'+flow+'-'+step,designerState.formName,updateProduct);}
document.getElementById('p_'+flow+'_'+step).style.visibility='visible';designerState.active.flow=flow;designerState.active.step=step;designerState.last[flow]=step;}
function reloadCurrentContent(){loadInnerHTMLCallback(document.getElementById('p_'+designerState.active.flow+'_'+designerState.active.step),designerState.callBackUrl+'/fill/'+designerState.active.flow+'-'+designerState.active.step,function(responseText){loadInitialZoomWindow(responseText);loadNext(designerState.active.flow,designerState.active.step)},true);}
function updateChanges(){var oldChanges=designerState.pendingChanges;designerState.pendingChanges=new Array();var update=false;while(oldChanges.length>0){var parts=oldChanges.shift();if(updateDesigner(parts))
update=true;}
if(update)
getCallback(designerState.callBackUrl+'/update/'+designerState.active.flow+'-'+designerState.active.step,designerState.formName,updateProduct);}
function loadNext(flow,step){designerState.loaded[flow][step]=1;updateChanges();return;if(designerState.loaded[flow][step-1]!=null&&designerState.loaded[flow][step-1]==0){loadInnerHTMLCallback(document.getElementById('p_'+(flow)+'_'+(step-1)),designerState.callBackUrl+'/fill/'+(flow)+'-'+(step-1),function(responseText){loadInitialZoomWindow(responseText);loadNext(flow,step-1);},true);}else if(designerState.loaded[flow-1]!=null){var lastStepInFlow=designerState.loaded[flow-1].length;if(designerState.loaded[flow-1][lastStepInFlow]!=null&&designerState.loaded[flow-1][lastStepInFlow]==0){loadInnerHTMLCallback(document.getElementById('p_'+(flow-1)+'_'+(lastStepInFlow)),designerState.callBackUrl+'/fill/'+(flow-1)+'-'+(lastStepInFlow),function(responseText){loadInitialZoomWindow(responseText);loadNext(flow-1,lastStepInFlow);},true);}}
if(designerState.loaded[flow][step+1]!=null&&designerState.loaded[flow][step+1]==0){loadInnerHTMLCallback(document.getElementById('p_'+(flow)+'_'+(step+1)),designerState.callBackUrl+'/fill/'+(flow)+'-'+(step+1),function(responseText){loadInitialZoomWindow(responseText);loadNext(flow,step+1);},true);}else if(designerState.loaded[flow+1]!=null&&designerState.loaded[flow+1][1]!=null&&designerState.loaded[flow+1][1]==0){loadInnerHTMLCallback(document.getElementById('p_'+(flow+1)+'_'+(1)),designerState.callBackUrl+'/fill/'+(flow+1)+'-'+(1),function(responseText){loadInitialZoomWindow(responseText);loadNext(flow+1,1);},true);}
return true;}
function checkIfAllPagesAreLoaded(){for(var flow in designerState.loaded){for(var step in designerState.loaded[flow]){if(designerState.loaded[flow][step]==0)
return false;}}
return true;}
function setAttributeOf(node,attribute,value){if(node[attribute]){node[attribute]=value;}else if(node.setAttribute){node.setAttribute(attribute,value);}else if(document.createAttribute&&node.setAttributeNode){var attributeNode=document.createAttribute(attribute);attributeNode.value=value;node.setAttributeNode(attributeNode);}else if(node.attributes[attribute]){node.attributes[attribute]=value;}}
function addCheckBoxToForm(node,form,value){for(var count=0;count<node.parentNode.childNodes.length;++count){if(node.parentNode.childNodes[count].tagName=='INPUT')node=node.parentNode.childNodes[count];}
try{if(!document.getElementById(form)[node.name]||node.checked||(document.getElementById(form)[node.name]&&document.getElementById(form)[node.name].value==value)){tmpElement=document.createElement('input');setAttributeOf(tmpElement,'id',form+'_added_'+node.name);setAttributeOf(tmpElement,'name',node.name);setAttributeOf(tmpElement,'type','hidden');document.getElementById(designerState.formName).appendChild(tmpElement);setAttributeOf(tmpElement,'value',node.checked?node.value:0);}}catch(e){;}
try{update();}catch(e){;}
try{document.getElementById(designerState.formName).removeChild(tmpElement);}catch(e){;}}
function check(node,optionalForm,concerns){if(optionalForm&&concerns){for(var count=0;count<node.childNodes.length;++count){if(node.childNodes[count].tagName=='INPUT')node=node.childNodes[count];}
var tmpElement=document.getElementById(optionalForm+'_added_'+node.name);if(!tmpElement){try{if(!document.getElementById(optionalForm)[node.name]||node.value==concerns||node.value!=0||(document.getElementById(optionalForm)[node.name]&&document.getElementById(optionalForm)[node.name].value==concerns)){tmpElement=document.createElement('input');setAttributeOf(tmpElement,'id',optionalForm+'_added_'+node.name);setAttributeOf(tmpElement,'name',node.name);setAttributeOf(tmpElement,'type','hidden');document.getElementById(designerState.formName).appendChild(tmpElement);setAttributeOf(tmpElement,'value',node.value);}}catch(e){;}}else{if(tmpElement.value==0||tmpElement.value==concerns){setAttributeOf(tmpElement,'value',node.value);}else{}}
node.checked=true;radio(node);document.getElementById(designerState.formName).removeChild(tmpElement);}else{for(var count=0;count<node.childNodes.length;++count){if(node.childNodes[count].tagName=='INPUT')node=node.childNodes[count];}
node.checked=true;radio(node);}
return false;}
function radio(node){var nodes=document.getElementsByName(node.name);for(var i=0;i<nodes.length;++i){var pos=nodes[i].parentNode.className.lastIndexOf('checked');if(pos<0)pos=nodes[i].parentNode.className.length;nodes[i].parentNode.className=nodes[i].parentNode.className.substr(0,pos)+(nodes[i].checked?' checked':'');}
getCallback(designerState.callBackUrl+'/update/'+designerState.active.flow+'-'+designerState.active.step,designerState.formName,updateProduct);}
function update(){getCallback(designerState.callBackUrl+'/update/'+designerState.active.flow+'-'+designerState.active.step,designerState.formName,updateProduct);}
function updateProductInfo(product_url,productId){updateModalPopup(product_url,600,400);}
function showContrastFabricChoices(fabricId){lastZoomPics=new Array();popup('contrastFabricsChoices','',716,550,function(){doUpdateMainView=true;reloadCurrentContent();update();killPopup();},0,200);loadInnerHTMLCallback(document.getElementById('contrastFabricsChoicesContent'),designerState.callBackUrl+'/fetchContent/getContrastFabricsChoices?for_fabric='+fabricId,function(){doUpdateMainView=false;update();});}
function showDialog(dialogName,width,height,params){var width=width!=null&&width>0?width:400;var height=height!=null&&height>0?height:400;var params=params!=null?params:'';popup('dialogWidget','',width,height);getCallback(designerState.callBackUrl+'/showDialog/'+dialogName,designerState.formName,function(responseText){document.getElementById('dialogWidgetContent').innerHTML=responseText;},params);}
function addToCart_safe(){document.getElementById('addToCart').value=1;update();document.getElementById('addToCart').value=0;}
function addToCart(productId,createBox,showGoToCartLink){var productId=productId!=null?productId:0;if(productId>0){var cmd=cartURL+'/addnew/'+productId+'?isAjax=1';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();}
if(document.getElementById('product_info_module_div'))document.getElementById('product_info_module_div').innerHTML='';xmlhttp.open('GET',cmd,false);xmlhttp.send(null);var content=xmlhttp.responseText;showCartSummary();var cartContents=document.getElementById('cart_contents');if(typeof(cartContents)!='undefined'&&cartContents!=null){cartContents.innerHTML=content;}
killPopup();}else{popup('ooook','',400,250,function(){return false;});getCallback(designerState.callBackUrl+'/addToCart',designerState.formName,addToCartCallback);}}
function addToCartCallback(responseText){showCartSummary();document.getElementById('ooookContent').innerHTML=responseText;}
var lastZoomPics=new Array();var doUpdateMainView=true;function updateProduct(ajaxResponse){timeB('ajax');timeA('update');var update=false;var lines=ajaxResponse.split('\n');for(var line in lines){if(!ignoreUpdates){if(line=='length')continue;var parts=lines[line].split('\t');switch(parts[0]-0){case 1:if(!(lastZoomPics[parts[1]]!=null&&lastZoomPics[parts[1]]==lines[line])){lastZoomPics[parts[1]]=lines[line];updateZoom(parts);}
break;case 2:if(doUpdateMainView){if(!(lastZoomPics[parts[0]]!=null&&lastZoomPics[parts[0]]==lines[line])){lastZoomPics[parts[0]]=lines[line];updateMainView(parts);}}
break;case 3:if(!(lastZoomPics[parts[1]]!=null&&lastZoomPics[parts[1]]==lines[line])){lastZoomPics[parts[1]]=lines[line];updateZoom(parts);}
break;case 4:if(updateDesigner(parts))
update=true;break;case 5:break;case 6:;break;case 7:break;case 8:break;case 9:updateDesignPrice(parts[1]);break;case 10:updateContrastFabricSummary(parts[1]);break;}}}
if(ignoreUpdates){sjaxCall(designerState.callBackUrl+'/restore');ignoreUpdates=false;reloadCurrentContent();}else if(update){getCallback(designerState.callBackUrl+'/update/'+designerState.active.flow+'-'+designerState.active.step,designerState.formName,updateProduct);}
timeB('update');}
function updateDesignPrice(parts){document.getElementById('totalPrice').innerHTML=parts;}
function updateContrastFabricSummary(parts){sumNode=document.getElementById('contrastFabrics_summary');if(sumNode&&typeof sumNode!='undefined')sumNode.innerHTML=parts;}
function isElementLoaded(elementId){if(document.getElementById(elementId)){if(typeof designerState.pageElements!='undefined'&&designerState.pageElements[elementId]){var pages=designerState.pageElements[elementId];for(var page in pages){if(designerState.loaded[pages[page].flow][pages[page].step]==0){return false;}}}
return true;}
return false;}
var ignoreUpdates=false;function updateDesigner(parts){var command=parts[1];var element=parts[2];if(parts[3])var value=parts[3];var update=false;switch(command){case'hide':if(value){var standard=parts[4];if(isElementLoaded(element)){if(document.getElementById(element).type=='select-one'){if(document.getElementById(element).value==value){combobox_select(document.getElementById(element+'_'+standard+'b'));}
document.getElementById(element+'_'+value+'b').style.display='none';}else{if(document.getElementById(element+'_'+value).checked){document.getElementById(element+'_'+value).checked=false;document.getElementById(element+'_'+value).parentNode.className=document.getElementById(element+'_'+value).parentNode.className.substr(0,document.getElementById(element+'_'+value).parentNode.className.indexOf('checked'));document.getElementById(element+'_'+standard).checked=true;document.getElementById(element+'_'+standard).parentNode.className+=' checked';update=true;}
document.getElementById(element+'_'+value).disabled=true;document.getElementById(element+'_'+value).parentNode.style.display='none';}}else{designerState.pendingChanges.push(parts);}}else{if(isElementLoaded(element)){if(document.getElementById(element).type=='select-one'){document.getElementById(element).parentNode.style.display='none';}else{document.getElementById(element).style.display='none';}}else{designerState.pendingChanges.push(parts);}}
break;case'show':if(value){if(isElementLoaded(element+'_'+value)){if(document.getElementById(element).type=='select-one'){document.getElementById(element+'_'+value+'b').style.display='block';}else{document.getElementById(element+'_'+value).enabled=true;document.getElementById(element+'_'+value).parentNode.style.display='block';}}else{designerState.pendingChanges.push(parts);}}else{if(isElementLoaded(element)){if(document.getElementById(element).type=='select-one'){document.getElementById(element).parentNode.style.display='block';}else{document.getElementById(element).style.display='block';}}else{designerState.pendingChanges.push(parts);}}
break;case'rename':var newName=parts[4];if(isElementLoaded(element+'_'+value)){if(document.getElementById(element).type=='select-one'){}else{document.getElementById('_nameOf_'+element+'_'+value).innerHTML=newName;}}else{designerState.pendingChanges.push(parts);}
break;case'disable':if(isElementLoaded(element)){if(typeof document.getElementById(element)!=null&&typeof document.getElementById(element).type!='undefined'&&document.getElementById(element).type=='checkbox'){document.getElementById(element).disabled=true;}else if(document.getElementById(element+'_combobox')!=null&&typeof document.getElementById(element+'_combobox')!='undefined'&&document.getElementById(element+'_combobox').className=='superDropDown'){}else{}}else{designerState.pendingChanges.push(parts);}
break;case'enable':if(isElementLoaded(element)){if(typeof document.getElementById(element)!=null&&typeof document.getElementById(element).type!='undefined'&&document.getElementById(element).type=='checkbox'){document.getElementById(element).disabled=false;}}else{designerState.pendingChanges.push(parts);}
break;case'select':var showParts=parts;showParts[1]='show';updateDesigner(showParts);var select=parts[4];if(isElementLoaded(element)){if(document.getElementById(element)&&document.getElementById(element).type=='select-one'){combobox_set(element,value);}else if(document.getElementById(element)&&document.getElementById(element).type=='checkbox'){if(document.getElementById(element).checked!=(value>0))
update=true;document.getElementById(element).checked=value>0;}else{node=document.getElementById(element+'_'+value);if(select==1){if(node.checked==false)update=true;node.checked=true;node.parentNode.className+=' checked';}
else{node.checked=false;node.parentNode.className=node.parentNode.className.slice(0,node.parentNode.className.lastIndexOf(' checked'));}}}else{designerState.pendingChanges.push(parts);}
break;case'setCommentsForPage':if(!parts[3])
parts[3]='';var commentBox='comment_'+parts[2];if(document.getElementById(commentBox)&&document.getElementById(commentBox)!=parts[3]){document.getElementById(commentBox).innerHTML=parts[3];}else{designerState.pendingChanges.push(parts);}
break;case'setInnerHTML':if(!parts[3])
parts[3]='';if(document.getElementById(parts[2])&&document.getElementById(parts[2])!=parts[3]){document.getElementById(parts[2]).innerHTML=parts[3];}else{designerState.pendingChanges.push(parts);}
break;case'msg':alert(parts[2].replace(/2%0A/g,'\n'));break;case'confirm':if(confirm(parts[2].replace(/2%0A/g,'\n'))){document.location.href=parts[3];return;}
break;case'reload':var elementId=parts[2];if(designerState.pageElements[element]){var pages=designerState.pageElements[element];for(var page in pages){if(pages[page].flow==designerState.active.flow&&pages[page].step==designerState.active.step){reloadCurrentContent();}else{designerState.loaded[pages[page].flow][pages[page].step]=0;}}}
break;case'setImageSrcOfChoice':if(isElementLoaded(element)){var src='/media/gfx/'+parts[4];var elementId='_imgOf_'+element+'_'+value;if(document.getElementById(elementId)&&document.getElementById(elementId).src!=src){document.getElementById(elementId).src=src;}}else{designerState.pendingChanges.push(parts);}
break;case'addToCart':addToCart();break;case'showDialog':var params=parts[4]!=null?parts[4]:'';showDialog(element,parts[3],params);break;case'continueOrCancel':if(!confirm(parts[2].replace(/2%0A/g,'\n'))){ignoreUpdates=true;}
break;case'navigateToElement':if(designerState.pageElements[element]){var pages=designerState.pageElements[element];for(var page in pages){if(!(pages[page].flow==designerState.active.flow&&pages[page].step==designerState.active.step)){go(pages[page].flow,pages[page].step);}}}
break;case'eval':eval(parts[2]);break;}
return update;}
var timingsTime={};var timingsVar={};function timeA(name){return;if(!timingsTime[name]){timingsTime[name]=[];timingsVar[name]={count:0,x:0,max:0,min:Number.MAX_VALUE};}
timingsTime[name][timingsTime[name].length]=[];timingsTime[name][timingsTime[name].length-1][0]=new Date().getTime();}
function timeB(name){return;timingsTime[name][timingsTime[name].length-1][1]=new Date().getTime();++timingsVar[name].count;var y=timingsTime[name][timingsTime[name].length-1][1]-timingsTime[name][timingsTime[name].length-1][0];timingsVar[name].max=Math.max(y,timingsVar[name].max);timingsVar[name].min=Math.min(y,timingsVar[name].min);timingsVar[name].x+=y;debug(name+' (ms): '+y+'/'+Math.round(timingsVar[name].x/timingsVar[name].count)+'/'+timingsVar[name].max+'/'+timingsVar[name].min);}
function updateZoom(parts){if(ie6){ie6_updateZoom(parts);return;}
var id=parts[1];var id2=id+'_2';if(!document.getElementById(id)){return;}
if(document.getElementById(id).style.zIndex<4){var div=document.getElementById(id);var old=document.getElementById(id2);}else{var div=document.getElementById(id2);var old=document.getElementById(id);}
if(parts[3]!=null&&parts[3].length>2){if(document.getElementById('zoom_text_for_'+parts[1]).innerHTML!=parts[3]){document.getElementById('zoom_text_for_'+parts[1]).innerHTML=parts[3];document.getElementById('zoom_text_for_'+parts[1]).style.display='block';}}else{document.getElementById('zoom_text_for_'+parts[1]).style.display='none';}
div.firstChild.innerHTML='';div.style.zIndex=4;var loading=div.parentNode.firstChild.nextSibling;loading.style.background='transparent';loading.style.background='transparent';changeOpac(loading,0);changeOpac(div,0);loading.zIndex=3;setTimeout(function(){fadeIn(loading,0.3)},150);old.style.zIndex=1;unconnect('PICS_ARE_DONE_'+parts[1].toUpperCase());connect('PICS_ARE_DONE_'+parts[1].toUpperCase(),function(){bugCrusher(div);fadeIn(div,0.2,45,parts[1].toUpperCase()+'_ZOOM');div.style.width='100%';div.style.height='100%';});loadImages(parts[2].split(','),div.firstChild,parts[1].toUpperCase());}
function updateMainView(parts){if(ie6){return ie6_updateMainView(parts);}
var id='mainView_1';var id2='mainView_2';var loading=document.getElementById('mainView_loading');if(document.getElementById(id).style.zIndex<5){var div=document.getElementById(id);var old=document.getElementById(id2);}else{var div=document.getElementById(id2);var old=document.getElementById(id);}
changeOpac(loading,0);loading.style.zIndex=3;changeOpac(div,0);div.innerHTML='';div.style.zIndex=5;loading.style.background='transparent';setTimeout(function(){fadeIn(loading,0.3)},150);old.style.zIndex=1;unconnect('PICS_ARE_DONE_MAINVIEW');connect('PICS_ARE_DONE_MAINVIEW',function(){bugCrusher(div);fadeIn(div,0.2,45,'MAINVIEW');});loadImages(parts[1].split(','),div,'MAINVIEW');}
function bugCrusher(elem){if(ie7||ie8)elem.focus();}
function page(name,page,div){var filter=getFilter(div);var sorting=getSorting(div);div=document.getElementById(div);loadInnerHTML(div,designerState.callBackUrl+'/fetchContent/'+name+'-'+page+sorting+'-'+filter);}
function getSorting(name){if(document.getElementById(name+'_frmSearchSort')!=null){var sorting=document.getElementById(name+'_frmSearchSort').options[document.getElementById(name+'_frmSearchSort').selectedIndex].value;return sorting>''&&sorting!=0?'.'+sorting:'';}
return'';}
function getFilter(name){var colour=getFilterAttrib(name+'_frmSearchColor');var pattern=getFilterAttrib(name+'_frmSearchPattern');var collection=getCollectionValue(name+'_frmSearchCollection');var output=(colour>''&&colour!=0?'colour='+colour:'');output+=';';output+=(pattern>0?'pattern='+pattern:'');output+=';';output+=(collection>0?'collection='+collection:'');return output;}
function getFilterAttrib(formid){var element=document.getElementById(formid);var item;if(element!=null){item=element.options[element.selectedIndex];}
return item!=null?item.value:'';}
function getCollectionValue(formid){if(ie6){return getFilterAttrib(formid);}
if(document.forms['daForm'][formid]==null){return 0;}
for(var index=0;index<document.forms['daForm'][formid].length;index++){var isChecked=document.forms['daForm'][formid][index].checked;if(isChecked){return document.forms['daForm'][formid][index].value;}}
return 0;}
function loadImage(src,name,pos){if(!pos)var pos={x:0,y:0,w:0,h:0};var pic=new Image();if(src.charAt(0)!='/')src=designerState.mediaServerName+'/media/gfx/'+src;if(src.substr(src.length-3,3)=='png'){if(pic.id==''){pic.id='ts_random_id_'+Math.floor(Math.random()*4104005+1)+'_'+Math.floor(Math.random()*4104005+1);}
pic.src=src;}else{pic.src=src;}
pic.style.position='absolute';pic.style.top=pos.y+'px';pic.style.left=pos.x+'px';if(pos.w!=0){pic.style.width=pos.w+'px';}
if(pos.h!=0){pic.style.height=pos.h+'px';}
if(checkIfImageIsLoaded(pic)){--imageLoading[name]['picsToLoad'];}else{pic.onload=function(){--imageLoading[name]['picsToLoad'];if(imageLoading[name]['picsToLoad']==0&&!imageLoading[name]['loadingImages']){doneWithLoadingImages(name);}};}
return pic;}
function imagesBeltAndSuspencer(name){if(imageLoading[name]['allImagesAreLoaded']||imageLoading[name]['loadingImages']){return;}
if(checkReadyImages(name)){doneWithLoadingImages(name);}else{imageLoading[name]['beltAndSuspencer']=setTimeout('imagesBeltAndSuspencer(\''+name+'\')',1500);}}
function doneWithLoadingImages(name){clearTimeout(imageLoading[name]['beltAndSuspencer']);imageLoading[name]['allImagesAreLoaded']=true;imageLoading[name]['loadingImages']=false;imageLoading[name]['picsToLoad']=0;imageLoading[name]['picsTotal']=0;imageLoading[name]['target']='';for(var img in imageLoading[name]['picsToLoadList']){imageLoading[name]['picsToLoadList'][img].onload='';imageLoading[name]['picsToLoadList'][img].onerror='';}
imageLoading[name]['picsToLoadList']=new Array();emit('PICS_ARE_DONE_'+name.toUpperCase());}
function checkIfImageIsLoaded(image){return true;if(image.complete){return true;}else if(typeof image.naturalWidth!='undefined'){if(image.naturalWidth===0){return false;}else if(image.naturalWidth>0){return true;}}
return false;}
function checkReadyImages(name){var pics=imageLoading[name]['picsToLoadList'];var tmpPicsToLoad=pics.length;for(var pic=0;pic<pics.length;++pic){if(checkIfImageIsLoaded(pics[pic])){--tmpPicsToLoad;}else{return false;}}
if(tmpPicsToLoad==0){return true;}else if(tmpPicsToLoad>0){return false;}
return true;}
allowDebug=false;function loadImages(images,target,name){if(typeof imageLoading!='object'){imageLoading=new Array();}
if(typeof imageLoading[name]!='object'){imageLoading[name]=new Array();}
imageLoading[name]=new Array();imageLoading[name]['picsToLoad']=images.length;imageLoading[name]['picsTotal']=images.length;imageLoading[name]['picsToLoadList']=new Array();imageLoading[name]['target']=target;imageLoading[name]['loadingImages']=true;imageLoading[name]['allImagesAreLoaded']=false;for(img in images){var pos={x:0,y:0,w:0,h:0};var src=images[img];if(images[img].indexOf('{')>0){src=images[img].substr(0,images[img].indexOf('{'));var end=images[img].substring(images[img].indexOf('{')+1,images[img].lastIndexOf('}'));end=end.split(';');if(end.length>0)pos.x=end[0];if(end.length>1)pos.y=end[1];if(end.length>2)pos.w=end[2];if(end.length>3)pos.h=end[3];}
var node=loadImage(src,name,pos);imageLoading[name]['picsToLoadList'].push(node);imageLoading[name]['target'].appendChild(node);}
imageLoading[name]['loadingImages']=false;if(imageLoading[name]['picsToLoad']==0){doneWithLoadingImages(name);}else{imageLoading[name]['beltAndSuspencer']=setTimeout('imagesBeltAndSuspencer(\''+name+'\')',3000);}}
function startSweep(div,name){fadeIn(div,0.5,45,name);}
function combobox_enable(elem){if(elem==null)return;if(typeof elem=='string'||typeof elem=='number'){debug('1: '+elem);elem=document.getElementById(elem+'_combobox');debug('1: '+elem);var id=elem;}else{debug('2: '+elem);var id=elem.id.substr(0,elem.id.lastIndexOf('_'));}
debug('3: '+elem.className);var select=elem.firstChild;debug(select.id);select.id=id;select.name=id;debug(select.nextSibling.className);var cover=select.nextSibling.firstChild;debug(cover.className);cover.className='combobox_cover';cover.onfocus='combobox_dropdown(this);';cover.onblur='combobox_soonclose(this);';}
function combobox_disable(elem){if(typeof elem=='string'||typeof elem=='number'){elem=document.getElementById(elem+'_combobox');var id=elem;}else{var id=elem.id.substr(0,elem.id.lastIndexOf('_'));}
var select=elem.firstChild;select.id=id+'_disabled';select.name=id+'_disabled';var cover=select.nextSibling.firstChild;cover.className='combobox_cover_disabled';cover.onfocus='';cover.onblur='';}
function combobox_catchclick(e){setTimeout(function(){readyToCloseDropdown=false;},1);}
function combobox_dropdown(elem){elem.onclick=function(){combobox_prepareclose(elem);};elem.parentNode.onmousedown=combobox_catchclick;elem.onkeypress=function(){combobox_key(elem);};var id=elem.parentNode.parentNode.id.substr(0,elem.parentNode.parentNode.id.lastIndexOf('_'));document.getElementById(id+'_combobox').style.zIndex=99999999;document.getElementById(id+'DropDown').style.display='block';if(ie6||ie7)document.getElementById(id+'_combobox').parentNode.parentNode.style.zIndex=99999;}
function combobox_key(elem){}
function combobox_prepareclose(elem){setTimeout(function(){elem.onclick=function(){elem.blur();};},1);}
function getReadyToClose(elem){if(readyToCloseDropdown){combobox_close(elem);}else{var onfocus=elem.onfocus;elem.onfocus=null;elem.focus();elem.onfocus=onfocus;}}
var readyToCloseDropdown=false;function combobox_soonclose(elem){readyToCloseDropdown=true;setTimeout(function(){getReadyToClose(elem);},2);}
function combobox_close(elem){elem.onmouseup='';elem.onclose='';var id=elem.parentNode.parentNode.id.substr(0,elem.parentNode.parentNode.id.lastIndexOf('_'));document.getElementById(id+'_combobox').style.zIndex='';document.getElementById(id+'DropDown').style.display='none';if(ie6||ie7)document.getElementById(id+'_combobox').parentNode.parentNode.style.zIndex='';return true;}
function combobox_movein(elem){if(elem.className.indexOf('selected')>=0)return;if(elem.className.indexOf('disabled')>=0)return;elem.className+=' hover';}
function combobox_moveout(elem){if(elem.className.indexOf('selected')>=0)return;if(elem.className.indexOf('disabled')>=0)return;if(elem.className.indexOf('even')===0){elem.className='even';}else{elem.className='';}}
function combobox_select(elem){if(elem.className.indexOf('selected')>=0)return;var id=elem.id.substr(0,elem.id.length-1);combobox_set(document.getElementById(id).parentNode.id,document.getElementById(id).value);setTimeout(function(){elem.parentNode.parentNode.firstChild.blur();},50);var id=elem.parentNode.parentNode.id.substr(0,elem.parentNode.parentNode.id.lastIndexOf('_'));elem.blur();elem.parentNode.blur();elem.parentNode.parentNode.blur();elem.parentNode.parentNode.firstChild.blur();return false;}
function combobox_set(id,value){var elem=document.getElementById(id);var index=0;for(var e in elem.childNodes){if(e=='length'||!elem.childNodes[e].value)continue;if(elem.childNodes[e].value==value){break;}
++index;}
elem.selectedIndex=index;elem.onchange();}
function combobox_update_selected(elem,onchange){var shownSelected=document.getElementById(elem.id+'_selected');var dropdown=document.getElementById(elem.id+'DropDown');var siblings=dropdown.childNodes;var selectedIndex=elem.selectedIndex-0;var selectedElem=document.createElement('SPAN');var i=0;for(var sibling in siblings){if(sibling=='length'||!siblings[sibling].id)continue;siblings[sibling].className=siblings[sibling].className.indexOf('even')>=0?'even':'';if(i==selectedIndex){selectedElem=siblings[sibling];siblings[sibling].className+=' selected';}
++i;}
shownSelected.innerHTML=selectedElem.innerHTML;onchange.call();}
function updateEmbroidery(textField){var text=textField.value;checkEmbroideryCharacters(textField);update();}
var embroideryDelayer=null;function killEmbroideryDelay(){if(embroideryDelayer!=null)
clearTimeout(embroideryDelayer);}
function delayUpdateEmbroidery(elem){killEmbroideryDelay();embroideryDelayer=setTimeout(function(){updateEmbroidery(elem)},300);}
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'){for(var item in arr){var value=arr[item];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');popup.onclick="return false;";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;for(receiver in signals[signal]){if(wait>0)setTimeout(signals[signal][receiver],wait);else if(signals[signal].length==1){signals[signal][receiver]();}else{setTimeout(signals[signal][receiver],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;}
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;}