function showAgb(mainControl)
{window.open(mainControl+"?EVENT=agbStandalone","AGB","toolbar=no,scrollbars=yes");}
function writeAgbLink(mainControl,agbText)
{document.write("<a class=\"navkleindunkel\" href=\"javascript: showAgb('"+mainControl+"');\">"+agbText+"</a>");}
function showAvoidance(mainControl)
{window.open(mainControl+"?EVENT=avoidanceStandalone&PHPSESSID=$PHPSESSID#avoidance","AVOIDANCE","toolbar=no,scrollbars=yes");}
function writeAvoidanceLink(mainControl,avoidanceText)
{document.write("<a class=\"navkleindunkel\" href=\"javascript: showAvoidance('"+mainControl+"');\">"+avoidanceText+"</a>");}
function setBlankTargetForElement(id)
{element=document.getElementById(id);if(null!=element&&element.target!=undefined)
{element.target="_blank";}}
function showItemImage(path,title,width,height)
{window.open(path,title,'width='+width+', height='+height);}
function writeDeleteCartAnchorTag(question,redirection,img_path,text)
{document.write("<a href=\"#\" onclick=\"deleteCart('"+question+"','"+redirection+"');\">");document.write('<img src="'+img_path+'" alt="'+text+'" /><br />'+text+'</a>');}
function deleteCart(question,redirection)
{if(confirm(question))
{document.location=redirection;}}
function setupSuggest(){SetupMMSuggest(document.getElementById('searchterm'),{'requestURL':'/mall/1/js/mmsuggest.php?query=$v$&','debug':false});}
function setElementStatus(elementId,enabled)
{var element=document.getElementById(elementId);if(null!=element)
{element.disabled=!enabled;}}
function increment(id,inc_value)
{var i=document.getElementById(id);if(i!=null&&i!='undefined')
{i.value=parseFloat(i.value)+((typeof(inc_value)=="undefined")?1.0:inc_value);}}
function decrement(id,minimum,dec_value)
{var i=document.getElementById(id);if(i!=null&&i!='undefined')
{i.value=Math.max(minimum,parseFloat(i.value)-((typeof(dec_value)=="undefined")?1.0:dec_value));}}
function switchFieldStates(containerId,state){$('#'+containerId+' *').each(function(i){if(this.disabled!='undefined'){this.disabled=!state?'disabled':'';}});if(state){$('#'+containerId+' label').each(function(i){$(this).removeClass('inaktiv');});}else{$('#'+containerId+' label').each(function(i){$(this).addClass('inaktiv');});};}
function toggleLightBox(activewin,overlay,mode){if(activewin!=null){activewin.style.display=mode;overlay.style.display=mode;}}
function toggleswitch(id,imgId,accordionId)
{var d=document.getElementById(id);if(d.style.display=='block')
{d.style.display='none';document.getElementById(imgId).src='/mall/1/img/accordion_closed.gif';document.getElementById(accordionId).className='accordion closed';}else{d.style.display='block';document.getElementById(imgId).src='/mall/1/img/accordion_opened.gif';document.getElementById(accordionId).className='accordion opened';}}
function retainedPosition(){var y=0;if(window.pageYOffset){y=window.pageYOffset;}else if(document.body&&document.body.scrollTop){y=document.body.scrollTop;}}
function request(url,method,data,callback){var http;var need_polling;if(typeof XMLHttpRequest!='undefined'){http=new XMLHttpRequest;need_polling=false;}else{try{http=new ActiveXObject("Msxml2.XMLHTTP");need_polling=true;}catch(e){try{http=new ActiveXObject("Microsoft.XMLHTTP");need_polling=true;}catch(e){http=null;}}}
if(!http){return false;}
if(data&&typeof data=='object'){var _data=[];for(var i in data){_data.push(i+'='+escape(data[i]));}
data=_data.join('&');delete _data;}
method=method.toUpperCase();if(method=='POST'){http.open(method,url,!!callback);http.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}else{if(data){if(url.search("/?/")==-1){url+='?'+data;}else{url+='&'+data;}}
data=null;http.open(method,url,!!callback);}
if(callback){if(need_polling){var timer;var timeout=1200;var poll=function(){if(http.readyState==4){timeout=1;callback(http);}
if(!--timeout){window.clearInterval(timer);timer=null;}}
timer=window.setInterval(poll,50);}else{http.onreadystatechange=function(){if(http.readyState==4){http.onreadystatechange=null;callback(http);}}}}
http.send(data);return true;}
function getXmlElementText(xml_element){if(typeof xml_element.text!='undefined')return xml_element.text;if(typeof xml_element.textContent!='undefined')return xml_element.textContent;return xml_element.textContent;}
function start_ajaxItemVariation_request(ajax_url,reload_url,item_id){function ajaxItemVariation_request_handler(xml_http_response){var xml=xml_http_response.responseXML;var html_element,xml_element;html_element=document.getElementById('baseprice_'+item_id);xml_element=xml.getElementsByTagName('baseprice')[0];if(html_element&&xml_element){html_element.innerHTML=getXmlElementText(xml_element);}
html_element=document.getElementById('actionprice_'+item_id);xml_element=xml.getElementsByTagName('actionprice')[0];if(html_element&&xml_element){html_element.innerHTML=getXmlElementText(xml_element);}
html_element=document.getElementById('itemnumber_'+item_id);xml_element=xml.getElementsByTagName('itemnumber')[0];if(html_element&&xml_element){html_element.innerHTML=getXmlElementText(xml_element);}
html_element=document.getElementById('variations_'+item_id);xml_element=xml.getElementsByTagName('valid_variation')[0];if(html_element&&xml_element){if(getXmlElementText(xml_element)=='true'){color="";}else{color='red';}
select_element_array=html_element.getElementsByTagName('select');for(i=0;i<select_element_array.length;++i){if(color){select_element_array[i].style.color=color;}else{select_element_array[i].style.color="green";select_element_array[i].style.color="";try{select_element_array[i].style.removeAttribute("color",true);}catch(e){}}}
document.getElementById('submit_allowed_'+item_id).value=getXmlElementText(xml_element);}}
if(request(ajax_url,'get',null,ajaxItemVariation_request_handler)){}else{if(reload_url){document.location.href=reload_url;}}}
