﻿//jquery.autocomplete
jQuery.autocomplete=function(input,options){var me=this;var $input=$(input).attr("autocomplete","off");if(options.inputClass){$input.addClass(options.inputClass);}
var results=document.createElement("div");var $results=$(results).hide().addClass(options.resultsClass).css("position","absolute");if(options.width>0){$results.css("width",options.width);}
$("body").append(results);input.autocompleter=me;var timeout=null;var prev="";var active=-1;var cache={};var keyb=false;var hasFocus=false;var lastKeyPressCode=null;var mouseDownOnSelect=false;var hidingResults=false;function flushCache(){cache={};cache.data={};cache.length=0;};flushCache();if(options.data!=null){var sFirstChar="",stMatchSets={},row=[];if(typeof options.url!="string"){options.cacheLength=1;}
for(var i=0;i<options.data.length;i++){row=((typeof options.data[i]=="string")?[options.data[i]]:options.data[i]);if(row[0].length>0){sFirstChar=row[0].substring(0,1).toLowerCase();if(!stMatchSets[sFirstChar])stMatchSets[sFirstChar]=[];stMatchSets[sFirstChar].push(row);}}
for(var k in stMatchSets){options.cacheLength++;addToCache(k,stMatchSets[k]);}}
$input.keydown(function(e){lastKeyPressCode=e.keyCode;switch(e.keyCode){case 38:e.preventDefault();moveSelect(-1);break;case 40:e.preventDefault();moveSelect(1);break;case 9:case 13:if(selectCurrent()){$input.get(0).blur();e.preventDefault();}
break;default:active=-1;if(timeout)clearTimeout(timeout);timeout=setTimeout(function(){onChange();},options.delay);break;}}).focus(function(){hasFocus=true;}).blur(function(){hasFocus=false;if(!mouseDownOnSelect){hideResults();}});hideResultsNow();function onChange(){if(lastKeyPressCode==46||(lastKeyPressCode>8&&lastKeyPressCode<32))return $results.hide();var v=$input.val();if(v==prev)return;prev=v;if(v.length>=options.minChars){$input.addClass(options.loadingClass);requestData(v);}else{$input.removeClass(options.loadingClass);$results.hide();}};function moveSelect(step){var lis=$("li",results);if(!lis)return;active+=step;if(active<0){active=0;}else if(active>=lis.size()){active=lis.size()-1;}
lis.removeClass("ac_over");$(lis[active]).addClass("ac_over");};function selectCurrent(){var li=$("li.ac_over",results)[0];if(!li){var $li=$("li",results);if(options.selectOnly){if($li.length==1)li=$li[0];}else if(options.selectFirst){li=$li[0];}}
if(li){selectItem(li);return true;}else{return false;}};function selectItem(li){if(!li){li=document.createElement("li");li.extra=[];li.selectValue="";}
var v=$.trim(li.selectValue?li.selectValue:li.innerHTML);$results.html("");window.open(v,"_top");};function createSelection(start,end){var field=$input.get(0);if(field.createTextRange){var selRange=field.createTextRange();selRange.collapse(true);selRange.moveStart("character",start);selRange.moveEnd("character",end);selRange.select();}else if(field.setSelectionRange){field.setSelectionRange(start,end);}else{if(field.selectionStart){field.selectionStart=start;field.selectionEnd=end;}}
field.focus();};function autoFill(sValue){if(lastKeyPressCode!=8){$input.val($input.val()+sValue.substring(prev.length));createSelection(prev.length,sValue.length);}};function showResults(){var pos=findPos(input);var iWidth=(options.width>0)?options.width:$input.width();$results.css({width:parseInt(iWidth)+"px",top:(pos.y+input.offsetHeight)+"px",left:pos.x+"px"}).show();};function hideResults(){if(timeout)clearTimeout(timeout);timeout=setTimeout(hideResultsNow,200);};function hideResultsNow(){if(hidingResults){return;}
hidingResults=true;if(timeout){clearTimeout(timeout);}
var v=$input.removeClass(options.loadingClass).val();if($results.is(":visible")){$results.hide();}
if(options.mustMatch){if(!input.lastSelected||input.lastSelected!=v){selectItem(null);}}
hidingResults=false;};function receiveData(q,data){if(data){$input.removeClass(options.loadingClass);results.innerHTML="";if(!hasFocus||data.length==0)return hideResultsNow();if($.browser.msie){$results.append(document.createElement('iframe'));}
results.appendChild(dataToDom(data,q));if(options.autoFill&&($input.val().toLowerCase()==q.toLowerCase()))autoFill(data[0][0]);showResults();}else{hideResultsNow();}};function parseData(data){if(!data)return null;var parsed=[];var rows=data.split(options.lineSeparator);for(var i=0;i<rows.length-18;i++){var row=$.trim(rows[i]);if(row){parsed[parsed.length]=row.split(options.cellSeparator);}}
return parsed;};function dataToDom(data,q){var ul=document.createElement("ul");var num=data.length;if((options.maxItemsToShow>0)&&(options.maxItemsToShow<num))num=options.maxItemsToShow;for(var i=0;i<num;i++){var row=data[i];if(!row)continue;var li;if(options.formatItem){if(options.formatItem(row,i,num)!=false){li=document.createElement("li");li.innerHTML=options.highlight(options.formatItem(row,i,num),q);li.selectValue=row[1];}}else{li.innerHTML=options.highlight(row[0],q);li.selectValue=row[1];}
var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j];}}
if(li){li.extra=extra;ul.appendChild(li);$(li).hover(function(){$("li",ul).removeClass("ac_over");$(this).addClass("ac_over");active=$("li",ul).indexOf($(this).get(0));},function(){$(this).removeClass("ac_over");}).click(function(e){e.preventDefault();e.stopPropagation();selectItem(this)});}}
$(ul).mousedown(function(){mouseDownOnSelect=true;}).mouseup(function(){mouseDownOnSelect=false;});return ul;};function requestData(q){if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data){receiveData(q,data);}else if((typeof options.url=="string")&&(options.url.length>0)){$.get(makeUrl(q),function(data){data=parseData(data);addToCache(q,data);receiveData(q,data);});}else{$input.removeClass(options.loadingClass);}};function makeUrl(q){var sep=options.url.indexOf('?')==-1?'?':'&';var url=options.url+sep+"q="+encodeURI(q);for(var i in options.extraParams){url+="&"+i+"="+encodeURI(options.extraParams[i]);}
if(document.getElementById('domlang')!=null)
{url+="&lan="+document.getElementById('domlang').value;}
if(document.getElementById('domPrdGrp')!=null)
{url+="&prdgp="+document.getElementById('domPrdGrp').value;}
if(document.getElementById('domain')!=null)
{if(document.getElementById('domain').value=="^^DOM^^")
url+="&domain=1";else
url+="&domain="+document.getElementById('domain').value;}
if(document.getElementById('bookType')!=null)
{url+="&bookType="+document.getElementById('bookType').value;}
return url;};function loadFromCache(q){if(!q)return null;if(cache.data[q])return cache.data[q];if(options.matchSubset){for(var i=q.length-1;i>=options.minChars;i--){var qs=q.substr(0,i);var c=cache.data[qs];if(c){var csub=[];for(var j=0;j<c.length;j++){var x=c[j];var x0=x[0];if(matchSubset(x0,q)){csub[csub.length]=x;}}
return csub;}}}
return null;};function matchSubset(s,sub){if(!options.matchCase)s=s.toLowerCase();var i=s.indexOf(sub);if(i==-1)return false;return i==0||options.matchContains;};this.flushCache=function(){flushCache();};this.setExtraParams=function(p){options.extraParams=p;};this.findValue=function(){var q=$input.val();if(!options.matchCase)q=q.toLowerCase();var data=options.cacheLength?loadFromCache(q):null;if(data){findValueCallback(q,data);}else if((typeof options.url=="string")&&(options.url.length>0)){$.get(makeUrl(q),function(data){data=parseData(data)
addToCache(q,data);findValueCallback(q,data);});}else{findValueCallback(q,null);}}
function findValueCallback(q,data){alet("hi");if(data)$input.removeClass(options.loadingClass);var num=(data)?data.length:0;var li=null;for(var i=0;i<num;i++){var row=data[i];if(row[0].toLowerCase()==q.toLowerCase()){li=document.createElement("li");if(options.formatItem){li.innerHTML=options.formatItem(row,i,num);li.selectValue=row[1];}else{li.innerHTML=row[0];li.selectValue=row[1];}
var extra=null;if(row.length>1){extra=[];for(var j=1;j<row.length;j++){extra[extra.length]=row[j];}}
li.extra=extra;}}
if(options.onFindValue)setTimeout(function(){options.onFindValue(li)},1);}
function addToCache(q,data){if(!data||!q||!options.cacheLength)return;if(!cache.length||cache.length>options.cacheLength){flushCache();cache.length++;}else if(!cache[q]){cache.length++;}

cache.data[q]=data;};function findPos(obj){var curleft=obj.offsetLeft||0;var curtop=obj.offsetTop||0;while(obj=obj.offsetParent){curleft+=obj.offsetLeft
curtop+=obj.offsetTop}
return{x:curleft,y:curtop};}}
jQuery.fn.autocomplete=function(url,options,data){options=options||{};options.url=url;options.data=((typeof data=="object")&&(data.constructor==Array))?data:null;options=$.extend({inputClass:"ac_input",resultsClass:"ac_results",lineSeparator:"\n",cellSeparator:"|",minChars:1,delay:400,matchCase:0,matchSubset:1,matchContains:0,cacheLength:1,mustMatch:0,extraParams:{},loadingClass:"ac_loading",selectFirst:false,selectOnly:false,maxItemsToShow:10,autoFill:false,width:0},options);options.width=parseInt(options.width,10);this.each(function(){var input=this;new jQuery.autocomplete(input,options);});return this;}
jQuery.fn.autocompleteArray=function(data,options){return this.autocomplete(null,options,data);}
jQuery.fn.indexOf=function(e){;for(var i=0;i<this.length;i++){if(this[i]==e)return i;}
return-1;};function trim(stringToTrim)
{return stringToTrim.replace(/^\s+|\s+$/g,"");}
var textsearch;var buchType;function findValue(li)
{if(li==null)return alert("No match!");if(!!li.extra)var sValue=li.extra[0];else var sValue=li.selectValue;}
function selectItem(li){findValue(li);}
function formatItem(row)
{if(row[0]!=""){ return "<a onclick='javascript:OpenDetailsWindow(this,"+row[2] + ");'	href='"+row[1] + "' target='_top'>"+row[0]+"</a>"}
else
return false}
function OpenDetailsWindow(box,id)
{
var webMethod = '/InforiusShopService/ShopService.asmx/UpdateSearchDetails';
 var parameters = "{'contextKey':'" + id + "'}";
$.ajax({
		type: "POST",
		url: webMethod,
		data: parameters,
		contentType: "application/json; charset=utf-8",
		dataType: "json",
		success: function(msg) {
		},
		error: function(e){
		}
	});
   window.open(box.href, box.target);
}

function GetAndUpdateSearchKeywordDetails(SearchText,Type)
{
var webMethod = '/InforiusShopService/ShopService.asmx/GetAndUpdateSearchKeywordDetails';
 var parameters = "{'SearchWord':'" + SearchText + "','KeywordType':'" + Type + "'}";
$.ajax({
		type: "POST",
		url: webMethod,
		data: parameters,
		contentType: "application/json; charset=utf-8",
		dataType: "json",
		success: function(msg) {
		},
		error: function(e){
		}
	});
}
function lookupAjax()
{var oSuggest=$("#Code")[0].autocompleter;oSuggest.findValue();return false;}
function highlightitem(value,term)
{var term1=term.split(" ");$.each(term1,function(x,y)
{if(y!="")
{value=value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+y.replace(/([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/gi,"\\$1")+")(?![^<>]*>)(?![^&;]+;)","gi"),"<span class='highlightcolor'>$1</span>");}});return value;}
$(document).ready(function()
{$("#Code").autocomplete("/InforiusShopService/AjaxSearch.aspx",{delay:600,minChars:3,matchSubset:1,matchContains:1,cacheLength:0,onItemSelect:selectItem,onFindValue:findValue,formatItem:formatItem,selectFirst:0,width:260,highlight:highlightitem,autoFill:false});});

//SearchManagement
/*
function submitsidebar(sidebarType)
{if(sidebarType!="sort")
{window.document.frmSearch.hdnSidebarType.value="Sort";window.document.frmSearch.hdnSidebarType.value=sidebarType;}
if(sidebarType=="addnsearch")
{window.document.frmSearch.hdnpagenumber.value=1;window.document.frmSearch.hdnPageGroup.value=1;}
window.document.frmSearch.submit();}
*/
function submitsidebardel(val)
{window.document.frmSearch.hdnsearchtxt.value = window.document.frmSearch.hdnsearchtxt.value.replace(val,""); window.document.frmSearch.submit();}

function submitsidebar(sidebarType)
{if(sidebarType!="sort")
{window.document.frmSearch.hdnSidebarType.value="Sort";window.document.frmSearch.hdnSidebarType.value=sidebarType;}
if(sidebarType=="addnsearch")
{window.document.frmSearch.hdnpagenumber.value=1;window.document.frmSearch.hdnPageGroup.value=1;window.document.frmSearch.hdnsidesearch.value=document.getElementById('addsearchtext').value;}
window.document.frmSearch.submit();}
function submitWarenSearch(SideBarValue)
{window.document.frmSearch.hdnSidebarType.value="SideBarsearch";window.document.frmSearch.hdnpagenumber.value=1;window.document.frmSearch.hdnPageGroup.value=1;window.document.frmSearch.hdnSideWaren.value=SideBarValue;window.document.frmSearch.submit();}
function submitLangaugeSearch(SideBarValue)
{window.document.frmSearch.hdnSidebarType.value="SideBarsearch";window.document.frmSearch.hdnpagenumber.value=1;window.document.frmSearch.hdnPageGroup.value=1;window.document.frmSearch.hdnlangauge.value=SideBarValue;window.document.frmSearch.submit();}
function submitPriceSearch(SideBarValue)
{window.document.frmSearch.hdnSidebarType.value="SideBarsearch";window.document.frmSearch.hdnpagenumber.value=1;window.document.frmSearch.hdnPageGroup.value=1;window.document.frmSearch.hdnSidePrice.value=SideBarValue;window.document.frmSearch.submit();}
function submitbooktype(booktype)
{window.document.frmSearch.hdnbooktype.value=booktype;window.document.frmSearch.hdnpagenumber.value=1;window.document.frmSearch.hdnPageGroup.value=1;window.document.frmSearch.submit();}
function submitOrderBy(intCurrentPagenumber,intCurrentPageGroup)
{window.document.frmSearch.hdnpagenumber.value=intCurrentPagenumber;window.document.frmSearch.hdnPageGroup.value=intCurrentPageGroup;
window.document.frmSearch.submit();}
function submitAlphaPaging(SideBarValue)
{window.document.frmSearch.hdnSidebarType.value="SideBarsearch";window.document.frmSearch.hdnpagenumber.value=1;window.document.frmSearch.hdnPageGroup.value=1;window.document.frmSearch.hdnAlphaPaging.value=SideBarValue;window.document.frmSearch.submit();}

function submitSortBy(SortBy)
{var Sortby_array=window.document.frmSearch.hdnSortBy.value.split("~");if(Sortby_array[0]==SortBy)
{if(Sortby_array[1]==1)
Sortby_array[1]=-1;else
Sortby_array[1]=1;window.document.frmSearch.hdnSortBy.value=Sortby_array[0]+"~"+Sortby_array[1];}
else{
  if(SortBy == 3 || SortBy == 4 )
     window.document.frmSearch.hdnSortBy.value = SortBy + "~0";//new sortbt type then default sorting is ASC
else
 window.document.frmSearch.hdnSortBy.value = SortBy + "~1";
}
window.document.frmSearch.submit();}
function submitOnArtPerPageChange(obj)
{var selIndex=obj.selectedIndex;window.document.frmSearch.hdnArtPerPage.value=obj.options[selIndex].value;window.document.frmSearch.hdnpagenumber.value=1;window.document.frmSearch.hdnPageGroup.value=1;window.document.frmSearch.submit();}
function submitAvailableSearch(AvailableValue)
{window.document.frmSearch.hdnSidebarType.value="SideBarsearch";window.document.frmSearch.hdnpagenumber.value=1;window.document.frmSearch.hdnPageGroup.value=1;window.document.frmSearch.hdnAvailable.value=AvailableValue;window.document.frmSearch.submit();}

 function submitAgeSearch(SideBarValue)
    {
      window.document.frmSearch.hdnSidebarType.value="SideBarsearch";
      window.document.frmSearch.hdnpagenumber.value=1;
      window.document.frmSearch.hdnPageGroup.value=1;
      window.document.frmSearch.hdnAge.value = SideBarValue ;
      window.document.frmSearch.submit();
    }
function Accordin(id)
	    {
		if(id != "")
        {
		var x;
		var ids = new Array();
		ids = id.split("|");
		for(x in ids)
		{
		 if(x == 0)
		  ddaccordion.expandone('expandable',ids[x]);
		 if(x == 1)
		  ddaccordion.expandone('subexpandable',ids[x]);
		 if(x== 2)
		  ddaccordion.expandone('sub2expandable',ids[x]);
				  if(x== 3)
		  ddaccordion.expandone('sub2expandable',ids[x]);
		}
        }
	    }
function submitAdvancedSearch()
{

var codeValue='';
var priceValue='';//price should be selected with other condition
var langValue=''
 if(document.getElementById('txtAuthor').value != '')  codeValue = codeValue + '1~' + document.getElementById('txtAuthor').value+'#*#';
 if(document.getElementById('txtTitle').value != '')  codeValue = codeValue + '0~' + document.getElementById('txtTitle').value+'#*#';
 if(document.getElementById('txtPublisher').value != '')  codeValue = codeValue + '2~' + document.getElementById('txtPublisher').value+'#*#';
 if(document.getElementById('txtKeyWord').value != '')  codeValue = codeValue + '8~' + document.getElementById('txtKeyWord').value+'#*#';
 if(document.getElementById('drpKat').value!="All") codeValue=codeValue+ '22~' +document.getElementById('drpKat').value+'#*#';
 if(document.getElementById('drpCov').value!="All") codeValue=codeValue+ '10~' +document.getElementById('drpCov').value+'#*#';
 if(document.getElementById('txtEAN').value != '')  codeValue = codeValue + '3~' + document.getElementById('txtEAN').value+'#*#';
 if(document.getElementById('drpLang').value!="All") langValue= '6~' +document.getElementById('drpLang').value+'#*#';
 if(document.getElementById('drpLang').value != "All" || (document.getElementById('txtEAN').value).trim() != '') langValue = '6~' + 'AdvSearch,' + document.getElementById('drpLang').value+'#*#';
 if(document.getElementById('txtPrice').value != '')  priceValue = '18~' + document.getElementById('txtPrice').value+'#*#';
 document.getElementById('type').value='gen';document.getElementById('code').value=codeValue+priceValue+langValue;
 //alert(codeValue);
 if(codeValue+langValue == '')
{document.getElementById('errorLbl').style.display = 'block';
document.getElementById('errorLbl').style.color = 'red';}
else
window.document.getElementById('frmAdvancedSearch').submit();}

jQuery(document).ready(function() {
    $("#FrmSearch input").live('keypress', function (e) {
    if ($(this).parents('#FrmSearch').find('button[type=submit].search-sub, input[type=image].search-sub').length <= 0)
    return true;

    if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
    $(this).parents('#FrmSearch').find('input[type=image].search-sub').click();
   // $(this).parents('#FrmSearch').find('button[type=submit].ssubmit, input[type=image].search-sub').click();
	
	return false;
    } else {
	 return true;
    }
    });
	$(".search-sub").click(function () {
	if($("#Code").val()!='')
	{

	    patt=/[^a-zA-Z0-9äöüÄÖÜß]/g;
             var newcode = $("#Code").val().replace(patt," ");
        if($("#shopUrl").val()!='')     
	        var url = $("#shopUrl").val()+ "suchen/Domainsearch/new/" + newcode +"/"; 
	    else
	        var url = "/suchen/Domainsearch/new/" + newcode +"/"; 
    	
	    //$(location).attr('href',url);
            $("#FrmSearch").attr('action',url);
            $("#FrmSearch").submit();
    }
    });
    }); 

function callTabIDSet(tabId)
{var selTab=tabId;var tabItem=document.getElementById("ULTabs");var divItem;var selDrp=document.FrmSearch.domain;var webMethod='/InforiusShopService/ShopService.asmx/GetDomainID';var parameters="{'domId':'"+tabId+"'}";$.ajax({type:"POST",url:webMethod,data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(msg){selTab=msg.d;for(i=0;i<tabItem.getElementsByTagName("li").length;i++)
{divItem=document.getElementById("nav-sub_"+tabItem.getElementsByTagName("li")[i].id);if(tabItem.getElementsByTagName("li")[i].id=='tab'+selTab)
{tabItem.getElementsByTagName("li")[i].className="on";if(divItem!=null)
{divItem.className="on";}}
else
{tabItem.getElementsByTagName("li")[i].className="";if(divItem!=null)
{divItem.className="off";}}}
if(selDrp!=null)
{selDrp.value=tabId;}},error:function(e){selTab=tabId;}});}

/***********************************************
* DD Tab Menu script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
//tabmenu
var ddtabmenu={disabletablinks:false,snap2original:[true,300],currentpageurl:window.location.href.replace("http://"+window.location.hostname,"").replace(/^\//,""),definemenu:function(tabid,dselected){this[tabid+"-menuitems"]=null
this[tabid+"-dselected"]=-1
this.addEvent(window,function(){ddtabmenu.init(tabid,dselected)},"load")},showsubmenu:function(tabid,targetitem){var menuitems=this[tabid+"-menuitems"]
this.clearrevert2default(tabid)
for(i=0;i<menuitems.length;i++){menuitems[i].className=""
if(typeof menuitems[i].hasSubContent!="undefined")
document.getElementById(menuitems[i].getAttribute("rel")).style.display="none"}
targetitem.className="current"
if(typeof targetitem.hasSubContent!="undefined")
document.getElementById(targetitem.getAttribute("rel")).style.display="block"},isSelected:function(menuurl){var menuurl=menuurl.replace("http://"+menuurl.hostname,"").replace(/^\//,"")
return(ddtabmenu.currentpageurl==menuurl)},isContained:function(m,e){var e=window.event||e
var c=e.relatedTarget||((e.type=="mouseover")?e.fromElement:e.toElement)
while(c&&c!=m)try{c=c.parentNode}catch(e){c=m}
if(c==m)
return true
else
return false},revert2default:function(outobj,tabid,e){if(!ddtabmenu.isContained(outobj,tabid,e)){window["hidetimer_"+tabid]=setTimeout(function(){ddtabmenu.showsubmenu(tabid,ddtabmenu[tabid+"-dselected"])},ddtabmenu.snap2original[1])}},clearrevert2default:function(tabid){if(typeof window["hidetimer_"+tabid]!="undefined")
clearTimeout(window["hidetimer_"+tabid])},addEvent:function(target,functionref,tasktype){var tasktype=(window.addEventListener)?tasktype:"on"+tasktype
if(target.addEventListener)
target.addEventListener(tasktype,functionref,false)
else if(target.attachEvent)
target.attachEvent(tasktype,functionref)},init:function(tabid,dselected){if(document.getElementById(tabid)!=null)
{var menuitems=document.getElementById(tabid).getElementsByTagName("a")
this[tabid+"-menuitems"]=menuitems
for(var x=0;x<menuitems.length;x++){if(menuitems[x].getAttribute("rel")){this[tabid+"-menuitems"][x].hasSubContent=true
if(ddtabmenu.disabletablinks)
menuitems[x].onclick=function(){return false}
if(ddtabmenu.snap2original[0]==true){var submenu=document.getElementById(menuitems[x].getAttribute("rel"))
menuitems[x].onmouseout=function(e){ddtabmenu.revert2default(submenu,tabid,e)}
submenu.onmouseover=function(){ddtabmenu.clearrevert2default(tabid)}
submenu.onmouseout=function(e){ddtabmenu.revert2default(this,tabid,e)}}}
else
menuitems[x].onmouseout=function(e){this.className="";if(ddtabmenu.snap2original[0]==true)ddtabmenu.revert2default(this,tabid,e)}
menuitems[x].onmouseover=function(){ddtabmenu.showsubmenu(tabid,this)}
if(dselected=="auto"&&typeof setalready=="undefined"&&this.isSelected(menuitems[x].href)){ddtabmenu.showsubmenu(tabid,menuitems[x])
this[tabid+"-dselected"]=menuitems[x]
var setalready=true}
else if(parseInt(dselected)==x){ddtabmenu.showsubmenu(tabid,menuitems[x])
this[tabid+"-dselected"]=menuitems[x]}}}}}

ddtabmenu.definemenu("nav", "auto") /*initialize Tab Menu #3 with 2nd tab selected*/

/***********************************************
* Accordion Content script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
//ddaccordion
var ddaccordion={contentclassname:{},expandone:function(headerclass,selected){this.toggleone(headerclass,selected,"expand")},collapseone:function(headerclass,selected){this.toggleone(headerclass,selected,"collapse")},expandall:function(headerclass){var $=jQuery
var $headers=$('.'+headerclass)
$('.'+this.contentclassname[headerclass]+':hidden').each(function(){$headers.eq(parseInt($(this).attr('contentindex'))).trigger("evt_accordion")})},collapseall:function(headerclass){var $=jQuery
var $headers=$('.'+headerclass)
$('.'+this.contentclassname[headerclass]+':visible').each(function(){$headers.eq(parseInt($(this).attr('contentindex'))).trigger("evt_accordion")})},toggleone:function(headerclass,selected,optstate){var $=jQuery
var $targetHeader=$('.'+headerclass).eq(selected)
var $subcontent=$('.'+this.contentclassname[headerclass]).eq(selected)
if(typeof optstate=="undefined"||optstate=="expand"&&$subcontent.is(":hidden")||optstate=="collapse"&&$subcontent.is(":visible"))
$targetHeader.trigger("evt_accordion")},expandit:function($targetHeader,$targetContent,config,useractivated,directclick){this.transformHeader($targetHeader,config,"expand")
$targetContent.slideDown(config.animatespeed,function(){config.onopenclose($targetHeader.get(0),parseInt($targetHeader.attr('headerindex')),$targetContent.css('display'),useractivated)
if(config.postreveal=="gotourl"&&directclick){var targetLink=($targetHeader.is("a"))?$targetHeader.get(0):$targetHeader.find('a:eq(0)').get(0)
if(targetLink)
setTimeout(function(){location=targetLink.href},200)}})},collapseit:function($targetHeader,$targetContent,config,isuseractivated){this.transformHeader($targetHeader,config,"collapse")
$targetContent.slideUp(config.animatespeed,function(){config.onopenclose($targetHeader.get(0),parseInt($targetHeader.attr('headerindex')),$targetContent.css('display'),isuseractivated)})},transformHeader:function($targetHeader,config,state){$targetHeader.addClass((state=="expand")?config.cssclass.expand:config.cssclass.collapse).removeClass((state=="expand")?config.cssclass.collapse:config.cssclass.expand)
if(config.htmlsetting.location=='src'){$targetHeader=($targetHeader.is("img"))?$targetHeader:$targetHeader.find('img').eq(0)
$targetHeader.attr('src',(state=="expand")?config.htmlsetting.expand:config.htmlsetting.collapse)}
else if(config.htmlsetting.location=="prefix")
$targetHeader.find('.accordprefix').html((state=="expand")?config.htmlsetting.expand:config.htmlsetting.collapse)
else if(config.htmlsetting.location=="suffix")
$targetHeader.find('.accordsuffix').html((state=="expand")?config.htmlsetting.expand:config.htmlsetting.collapse)},urlparamselect:function(headerclass){var result=window.location.search.match(new RegExp(headerclass+"=((\\d+)(,(\\d+))*)","i"))
if(result!=null)
result=RegExp.$1.split(',')
return result},getCookie:function(Name){var re=new RegExp(Name+"=[^;]+","i")
if(document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1]
return null},setCookie:function(name,value){document.cookie=name+"="+value+"; path=/"},init:function(config){document.write('<style type="text/css">\n')
document.write('.'+config.contentclass+'{display: none}\n')
document.write('<\/style>')
jQuery(document).ready(function($){ddaccordion.urlparamselect(config.headerclass)
var persistedheaders=ddaccordion.getCookie(config.headerclass)
ddaccordion.contentclassname[config.headerclass]=config.contentclass
config.cssclass={collapse:config.toggleclass[0],expand:config.toggleclass[1]}
config.revealtype=config.revealtype||"click"
config.revealtype=config.revealtype.replace(/mouseover/i,"mouseenter")
if(config.revealtype=="clickgo"){config.postreveal="gotourl"
config.revealtype="click"}
if(typeof config.togglehtml=="undefined")
config.htmlsetting={location:"none"}
else
config.htmlsetting={location:config.togglehtml[0],collapse:config.togglehtml[1],expand:config.togglehtml[2]}
config.oninit=(typeof config.oninit=="undefined")?function(){}:config.oninit
config.onopenclose=(typeof config.onopenclose=="undefined")?function(){}:config.onopenclose
var lastexpanded={}
var expandedindices=ddaccordion.urlparamselect(config.headerclass)||((config.persiststate&&persistedheaders!=null)?persistedheaders:config.defaultexpanded)
if(typeof expandedindices=='string')
expandedindices=expandedindices.replace(/c/ig,'').split(',')
var $subcontents=$('.'+config["contentclass"])
if(expandedindices.length==1&&expandedindices[0]=="-1")
expandedindices=[]
if(config["collapseprev"]&&expandedindices.length>1)
expandedindices=[expandedindices.pop()]
if(config["onemustopen"]&&expandedindices.length==0)
expandedindices=[0]
$('.'+config["headerclass"]).each(function(index){if(/(prefix)|(suffix)/i.test(config.htmlsetting.location)&&$(this).html()!=""){$('<span class="accordprefix"></span>').prependTo(this)
$('<span class="accordsuffix"></span>').appendTo(this)}
$(this).attr('headerindex',index+'h')
$subcontents.eq(index).attr('contentindex',index+'c')
var $subcontent=$subcontents.eq(index)
var needle=(typeof expandedindices[0]=="number")?index:index+''
if(jQuery.inArray(needle,expandedindices)!=-1){if(config.animatedefault==false)
$subcontent.show()
ddaccordion.expandit($(this),$subcontent,config,false)
lastexpanded={$header:$(this),$content:$subcontent}}
else{$subcontent.hide()
config.onopenclose($(this).get(0),parseInt($(this).attr('headerindex')),$subcontent.css('display'),false)
ddaccordion.transformHeader($(this),config,"collapse")}})
$('.'+config["headerclass"]).bind("evt_accordion",function(e,isdirectclick){var $subcontent=$subcontents.eq(parseInt($(this).attr('headerindex')))
if($subcontent.css('display')=="none"){ddaccordion.expandit($(this),$subcontent,config,true,isdirectclick)
if(config["collapseprev"]&&lastexpanded.$header&&$(this).get(0)!=lastexpanded.$header.get(0)){ddaccordion.collapseit(lastexpanded.$header,lastexpanded.$content,config,true)}
lastexpanded={$header:$(this),$content:$subcontent}}
else if(!config["onemustopen"]||config["onemustopen"]&&lastexpanded.$header&&$(this).get(0)!=lastexpanded.$header.get(0)){ddaccordion.collapseit($(this),$subcontent,config,true)}})
$('.'+config["headerclass"]).bind(config.revealtype,function(){if(config.revealtype=="mouseenter"){clearTimeout(config.revealdelay)
var headerindex=parseInt($(this).attr("headerindex"))
config.revealdelay=setTimeout(function(){ddaccordion.expandone(config["headerclass"],headerindex)},config.mouseoverdelay||0)}
else{$(this).trigger("evt_accordion",[true])
return false}})
$('.'+config["headerclass"]).bind("mouseleave",function(){clearTimeout(config.revealdelay)})
config.oninit($('.'+config["headerclass"]).get(),expandedindices)
$(window).bind('unload',function(){$('.'+config["headerclass"]).unbind()
var expandedindices=[]
$('.'+config["contentclass"]+":visible").each(function(index){expandedindices.push($(this).attr('contentindex'))})
if(config.persiststate==true&&$('.'+config["headerclass"]).length>0){expandedindices=(expandedindices.length==0)?'-1c':expandedindices
ddaccordion.setCookie(config.headerclass,expandedindices)}})})}}


//Rheinberg-Buch
function gEBI(x){return document.getElementById(x);}
function xtd(obj)
{clearlayers()
var sourcefield=obj.name;var xtdfieldname=sourcefield+"x";var xtdfield=gEBI(xtdfieldname);if(xtdfield)
{xtdfield.style.display=(xtdfield.style.display=="none")?'block':'none';setatcpos(sourcefield,xtdfieldname);}}
function cxtd(obj,event)
{var current_mouse_target=null;if(event.toElement){current_mouse_target=event.toElement;}else if(event.relatedTarget){current_mouse_target=event.relatedTarget;}
if(!icof(obj,current_mouse_target)&&obj!=current_mouse_target){obj.style.display='none';}}
function icof(parent,child)
{if(child!=null){while(child.parentNode){if((child=child.parentNode)==parent){return true;}}}
return false;}
function clearlayers()
{if(gEBI("meinkontox"))
{gEBI("meinkontox").style.display="none";}
if(gEBI("wunschlistex"))
{gEBI("wunschlistex").style.display="none";}
if(gEBI("merkzettelx"))
{gEBI("merkzettelx").style.display="none";}}
function setatcpos(sf,tf,left,top)
{if(left>0)
{leftpos=left;}
else
{leftpos=2;}
if(top>0)
{toppos=top;}
else
{toppos=32;}
var OBJ1=gEBI(sf);if(OBJ1)
{a=findPos(OBJ1);var OBJ2=gEBI(tf);if(OBJ2)
{var leftpos=((a[0])+leftpos)+"px";var toppos=((a[1])+toppos)+"px";OBJ2.style.left=leftpos;OBJ2.style.top=toppos;}}}
function findPos(obj)
{var curleft=curtop=0;if(obj.offsetParent)
{do
{curleft+=obj.offsetLeft;curtop+=obj.offsetTop;}
while(obj=obj.offsetParent);}
return[curleft,curtop];}
ddaccordion.init({headerclass:"expandable",contentclass:"categoryitems",revealtype:"click",mouseoverdelay:200,collapseprev:true,defaultexpanded:[],onemustopen:false,animatedefault:false,persiststate:false,toggleclass:["","openheader"],togglehtml:["prefix","",""],animatespeed:"fast",oninit:function(headers,expandedindices){},onopenclose:function(header,index,state,isuseractivated){}})
ddaccordion.init({headerclass:"subexpandable",contentclass:"subcategoryitems",revealtype:"click",mouseoverdelay:200,collapseprev:true,defaultexpanded:[],onemustopen:false,animatedefault:false,persiststate:false,toggleclass:["opensubheader","closedsubheader"],togglehtml:["none","",""],animatespeed:"fast",oninit:function(headers,expandedindices){},onopenclose:function(header,index,state,isuseractivated){}})
ddaccordion.init({headerclass:"sub2expandable",contentclass:"sub2categoryitems",revealtype:"click",mouseoverdelay:200,collapseprev:true,defaultexpanded:[],onemustopen:false,animatedefault:false,persiststate:false,toggleclass:["opensub2header","closedsub2header"],togglehtml:["none","",""],animatespeed:"fast",oninit:function(headers,expandedindices){},onopenclose:function(header,index,state,isuseractivated){}})
ddaccordion.init({headerclass:"sub3expandable",contentclass:"sub3categoryitems",revealtype:"click",mouseoverdelay:200,collapseprev:true,defaultexpanded:[],onemustopen:false,animatedefault:false,persiststate:false,toggleclass:["opensub3header","closedsub3header"],togglehtml:["none","",""],animatespeed:"fast",oninit:function(headers,expandedindices){},onopenclose:function(header,index,state,isuseractivated){}})
$().ready(function(){$('#faq').makeFAQ({indexTitle:"Rheinberg-Buch FAQ",displayIndex:true,faqHeader:"h3"});});(function($){$.fn.makeFAQ=function(options){var defaults={indexTitle:"Index",faqHeader:":header",displayIndex:true};var options=$.extend(defaults,options);return this.each(function(){var $obj=$(this);$obj.wrap("<div id='faqRoot'></div>");if(options.displayIndex){$obj.before("<div id='faqindex'><ul></ul></div>");};var $faqEntries=$obj.children(options.faqHeader);var i=0;$faqEntries.each(function(){var $entry=$(this);var $entry2=$(this).prev("h2");var SW_INFONAME=$entry2.text();if(SW_INFONAME!="")
{var SW_INFOSAFENAME=SW_INFONAME.replace(/\W/g,"")+i;var itemHTML="<li><a id='"+SW_INFOSAFENAME.toString()+"Index' href='#"+SW_INFOSAFENAME.toString()+"' >"+SW_INFONAME+"</a></li>";$('#faqindex ul').append(itemHTML);if(options.displayIndex){$('#'+SW_INFOSAFENAME.toString()+'Index').click(function(){$('#'+SW_INFOSAFENAME.toString()).next('span').slideDown('fast');$('#'+SW_INFOSAFENAME.toString()).addClass('faqopened');});};$entry2.attr({title:"Bitte anklicken",name:SW_INFOSAFENAME,id:SW_INFOSAFENAME})
i++;}
var entryName=$entry.text();var entryNameSafe=entryName.replace(/\W/g,"")+i;$entry.next("div").addClass('faqcontent');$entry.attr({title:"Bitte anklicken",name:entryNameSafe,id:entryNameSafe}).addClass("faqclosed").click(function(){$entry.next('div').slideToggle('fast');$entry.toggleClass('faqopened');}).next('div').css({display:"none"});});});};})(jQuery);
$(function(){$(".colorpop").colorbox({width:"600px", height:"400px", iframe:true,onComplete: function() {
        $("#cboxTitle").hide();
        

} });});
$(function(){$(".loginpop").colorbox({width:"600px", height:"300px", iframe:true,onComplete: function() {
        $("#cboxTitle").hide();
        

} });});




$(function(){$("#AGB,.versandlink,#A5,#RatingLogin,#widerrufsbelehrung").colorbox({width:"600px", height:"400px", iframe:true});});
$(function(){$(".comparislink").colorbox({width:"650px", height:"325px", iframe:true});});














































$(function(){$("a[rel=akimage_group]").colorbox({'hideOnOverlayClick':true,'padding':2,'transitionIn':'none','transitionOut':'none','titlePosition':'over','titleFormat':function(title,currentArray,currentIndex,currentOpts){return'<span id="fancybox-title-over"> ' +  title + '</span>';}});});
$(document).ready(function(){$("div.item-top10all").show();
$("div.top-10").each(function(){var thisArticle=this;
$(".item-top10all a.close",thisArticle).hide();
$("div.item-top10:gt(2)",thisArticle).hide();
if($("div.item-top10",thisArticle).size()<=3){
$(".item-top10all",thisArticle).hide();}


$(".item-top10all a.open, .item-top10all a.close",thisArticle).click(function(){$(".item-top10all a.open, .item-top10all a.close, div.item-top10:gt(2)",thisArticle).toggle();return false;});});});



//Cart Functions
function fnResetCartWithCookie()
{Inooga.Inforius.Web.PMS.Cartservice.ResetCartWithCookieData(ResetCartOnSucceeded,ResetCartOnFailed);}
function ResetCartOnSucceeded(result,eventArgs)
{RefreshMiniCart(result);}
function ResetCartOnFailed(error)
{}

















































function AddItemstoCart(qty, ean)
{ Inooga.Inforius.Web.PMS.Cartservice.AddItemsToCart(qty, ean, AddItemstoCartOnSucceeded, AddItemstoCartOnFailed); }
function AddItemstoCartOnSucceeded(result, eventArgs) {
    if (result != '') {
        if (result.indexOf('^') > 0) {
            var Msgresult = result.split('^');
            var msg = Msgresult[0];
            $.fn.colorbox({html:msg,width:"600px"});



            RefreshMiniCart(Msgresult[1]);
        }
        else {RefreshMiniCart(result);}
    }
}
function AddCartItemstoCart(qty, ean)
{ Inooga.Inforius.Web.PMS.Cartservice.AddItemsToCart(qty, ean, AddCartItemstoCartOnSucceeded, AddItemstoCartOnFailed); }
function AddCartItemstoCartOnSucceeded(result, eventArgs) {
    if (result != '') {
        if (result.indexOf('^') > 0) {
            var Msgresult = result.split('^');
            var msg = Msgresult[0];
            $.fn.colorbox({html:msg,width:"600px"});



            RefreshMiniCart(Msgresult[1]);
        }
        else {RefreshMiniCart(result);}
    }
}
function AddItemstoCartOnFailed(error)
{ }
function AddItemstoCartFromPopup(qty, ean)
{ Inooga.Inforius.Web.PMS.Cartservice.AddItemsToCart(qty, ean, AddItemstoCartFromPopupOnSucceeded, AddItemstoCartOnFailed); }
function AddItemstoCartFromPopupOnSucceeded(result, eventArgs) {
    if (result != '') {


        if (result.indexOf('^') > 0) {
            var Msgresult = result.split('^');
            var msg = Msgresult[0];
            $.fn.colorbox({html:msg,width:"500px"});



            RefreshMiniCartFromPopup(Msgresult[1]);
        }
        else {RefreshMiniCartFromPopup(result);}
    }
} function RefreshMiniCartFromPopup(result)
{if(result!='')
{var ItemCount=result.split('|');if(ItemCount.length>1)
{if(parent.document.getElementById('divArticle')!=null)
parent.document.getElementById('divArticle').innerHTML=ItemCount[1];if(parent.document.getElementById('divSum')!=null)
parent.document.getElementById('divSum').innerHTML=ItemCount[0];}}}
function AddItemsToCartFromWList(qty,ean,from)
{Inooga.Inforius.Web.PMS.Cartservice.AddItemsToCartFromWishList(qty,ean,from,AddItemsToCartFromWListOnSucceeded,AddItemsToCartFromWListOnFailed);}
function AddItemsToCartFromWListOnSucceeded(result, eventArgs) {
    if (result != '') {
        
        if (result.indexOf('^') > 0) {
            var Msgresult = result.split('^');
            var msg = Msgresult[0];
            var listID = "#Liste_li_"
            if (Msgresult.length > 2) {
                listID = listID + Msgresult[2];
                $(listID).hide();
            }
            $.fn.colorbox({html:msg,width:"600px"});



            RefreshMiniCart(Msgresult[1]);
        }
        else {
            RefreshMiniCart(result);
        }
    }
} function AddItemsToCartFromWListOnFailed(error)
{}
function AddItemstoWishlist(ean, code)
{ Inooga.Inforius.Web.PMS.Cartservice.AddItemsToWishlist(ean, code, AddItemstoWishlistOnSucceeded, AddItemstoWishlistOnFailed); }
function AddItemstoWishlistOnSucceeded(result, eventArgs) {
    if (result != '') {
        var msg = "<p class='pop-message' >" + JScriptRes.MerkListMsg + "</p>";
       
        $.fn.colorbox({html:msg,width:"500px",'onComplete': function() { setTimeout('$.fn.colorbox.close()', 1000); },'onClosed': function() { EmptycartMsgShowing(result) }});

    }
}


function AddCartItemstoCartForAmazonBlock(qty, ean)
{ Inooga.Inforius.Web.PMS.Cartservice.AddItemsToCartForAmazonBlock(qty, ean, AddCartItemstoCartForAmazonBlockOnSucceeded, AddCartItemstoCartForAmazonBlockOnFailed); }
function AddCartItemstoCartForAmazonBlockOnSucceeded(result, eventArgs) {
    if (result != '') {
        RefreshMiniCart(result); parent.location.reload(1);

    }
}
function AddCartItemstoCartForAmazonBlockOnFailed(error)
{ } 
function EmptycartMsgShowing(result)
{var ItemCount=result.split('|');RefreshMiniCart(result);if(ItemCount.length>2)
{var lidiv='cart_li_'+ItemCount[8];if(document.getElementById(lidiv)!=null)
document.getElementById(lidiv).innerHTML='';if(ItemCount[1]=="0")
{ Inooga.Inforius.Web.PMS.Cartservice.RemoveCartSession(RemoveCartSessionOnSucceeded, RemoveCartSessionOnFailed); } 
} if (document.getElementById("divUCChargeControl") != null)
    RenderWebshopperAuthorisedControl();
if (document.getElementById("divAmazonBlock") != null) {
    RenderAmazonBlock(); RefreshStuCardPoints();
}
}
function AddItemstoWishlistOnFailed(error)
{}
function DeleteItemsFromWishlist(ean)
{Inooga.Inforius.Web.PMS.Cartservice.DeleteItemsFromWishlist(ean,DeleteItemsFromWishlistOnSucceeded,DeleteItemsFromWishlistOnFailed);}
function DeleteItemsFromWishlistOnSucceeded(result,eventArgs)
{if(result!='')
{var ItemCount=result.split('|');var lidiv='divMerkList'+ItemCount[0];if(document.getElementById(lidiv)!=null)
document.getElementById(lidiv).innerHTML='';if(ItemCount.length>1)
{if(ItemCount[1]=="0")
{if(document.getElementById('MerklisteBlock')!=null)
document.getElementById('MerklisteBlock').innerHTML=JScriptRes.ShopServices_NoData;}}}}
function DeleteItemsFromWishlistOnFailed(error)
{}
function AddItemstoHistory(ean)
{Inooga.Inforius.Web.PMS.Cartservice.AddItemsToHistory(ean,AddItemstoHistoryOnSucceeded,AddItemstoHistoryOnFailed);}
function AddItemstoHistoryOnSucceeded(result,eventArgs)
{if(result!='')
{RefreshMiniCart(result);}}
function AddItemstoHistoryOnFailed(error)
{}
function gotoManageCart()
{Inooga.Inforius.Web.PMS.Cartservice.GoToCartGrid(GoToCartGridOnSucceeded,GoToCartGridOnFailed);}
function GoToCartGridOnSucceeded(result,eventArgs)
{if(result!='')
{var ItemCount=result.split('|');if(ItemCount[1]=="0")
{var msg="<p class='pop-message' >"+JScriptRes.EmptycartMsg+"</p>";$(function(){$.fn.colorbox({html:msg,width:"600px",'onComplete':function(){setTimeout('$.fn.colorbox.close()',2000);}});});}
else
window.location=ItemCount[2];}}
function GoToCartGridOnFailed(error)
{}
function DeleteItemsFromCart(ean,code)
{Inooga.Inforius.Web.PMS.Cartservice.DeleteItemsFromCart(ean,code,DeleteItemsFromCartOnSucceeded,DeleteItemsFromCartOnFailed);}
/*
function DeleteItemsFromCartOnSucceeded(result, eventArgs) {
    if (result != '') {
        var ItemCount = result.split('|'); var lidiv = 'cart_li_' + ItemCount[8]; RefreshMiniCart(result); document.getElementById(lidiv).innerHTML = ''; if (ItemCount[1] == "0")
        { Inooga.Inforius.Web.PMS.Cartservice.RemoveCartSession(RemoveCartSessionOnSucceeded, RemoveCartSessionOnFailed); }
        if (document.getElementById("hdnIsVoucherReq") != null) {
            if (document.getElementById("hdnIsVoucherReq").value == "True") {
                CheckGiftVoucherInCart();
            }
            else { RenderWebshopperAuthorisedControl(); }
        }
        
        RefreshStuCardPoints(); RenderAmazonBlock();
    }
}*/
function DeleteItemsFromCartOnSucceeded(result, eventArgs) {
    if (result != '') {
        var ItemCount = result.split('|'); var lidiv = 'cart_li_' + ItemCount[9]; RefreshMiniCart(result); $("#"+lidiv).attr("innerHTML",''); if (ItemCount[1] == "0")
        { Inooga.Inforius.Web.PMS.Cartservice.RemoveCartSession(RemoveCartSessionOnSucceeded, RemoveCartSessionOnFailed); }
        if ($("#hdnIsVoucherReq").val() == "True") {CheckGiftVoucherInCart();}
        else { RenderWebshopperAuthorisedControl(); }
        RefreshStuCardPoints(); RenderAmazonBlock();
    }
}
function RemoveCartSessionOnSucceeded(result, eventArgs)
{var msg="<p class='pop-message' >"+JScriptRes.EmptycartMsg+"</p>";$(function(){$.fn.colorbox({html:msg,width:"600px",'onComplete':function(){setTimeout('$.fn.colorbox.close()',2000);},'onClosed':function(){window.location.href=result;}});});}
function RemoveCartSessionOnFailed(error)
{}
function DeleteItemsFromCartOnFailed(error)
{}
function UpdateCartData(ean,code)
{var inputid='prd_qty_'+code;var Qty=document.getElementById(inputid).value;if(Qty=="0")
{Inooga.Inforius.Web.PMS.Cartservice.DeleteItemsFromCart(ean,code,DeleteItemsFromCartOnSucceeded,DeleteItemsFromCartOnFailed);}
else if(Qty!="")
{Inooga.Inforius.Web.PMS.Cartservice.UpdateItemsInCart(Qty,ean,code,UpdateCartDataOnSucceeded,UpdateCartDataOnFailed);}}
function checkquantity(ean,code)
{var inputid='prd_qty_'+code;var Qty=document.getElementById(inputid).value;if(Qty=="")
{Inooga.Inforius.Web.PMS.Cartservice.UpdateItemsInCart(Qty,ean,code,UpdateCartDataOnSucceeded,UpdateCartDataOnFailed);}}
/*function UpdateCartDataOnSucceeded(result, eventArgs) {
    if (result != '') {
        var ItemCount = result.split('|'); if (ItemCount[9] != null && ItemCount[9] != '' && ItemCount[9] != "0")
        { var inputid = 'prd_qty_' + ItemCount[8]; document.getElementById(inputid).value = ItemCount[9]; return; }
        var subTotaldiv = 'divSubTotal_' + ItemCount[8]; RefreshMiniCart(result); if (document.getElementById(subTotaldiv) != null)
        { document.getElementById(subTotaldiv).innerHTML = ItemCount[2]; }
        if (document.getElementById("hdnIsVoucherReq") != null) {
            if (document.getElementById("hdnIsVoucherReq").value == "True") {
                CheckGiftVoucherInCart();
            }
            else { RenderWebshopperAuthorisedControl(); }
        }
         
        RefreshStuCardPoints();

    }
}
*/
function UpdateCartDataOnSucceeded(result, eventArgs) {
    if (result != '') {
        var ItemCount = result.split('|'); if (ItemCount[10] != null && ItemCount[10] != '' && ItemCount[10] != "0")
        { var inputid = 'prd_qty_' + ItemCount[9]; document.getElementById(inputid).value = ItemCount[10]; return; }
        var subTotaldiv = 'divSubTotal_' + ItemCount[9]; RefreshMiniCart(result); if (document.getElementById(subTotaldiv) != null)
        { document.getElementById(subTotaldiv).innerHTML = ItemCount[2]; }
        if ($("#hdnIsVoucherReq").val() == "True") {CheckGiftVoucherInCart();}
        else { RenderWebshopperAuthorisedControl(); }
        RefreshStuCardPoints();
    }
}
function UpdateCartDataOnFailed(error)
{}
function ChkBasketSession()
{Inooga.Inforius.Web.PMS.Cartservice.CheckBasketSession(ChkBasketSessionOnSucceeded,ChkBasketSessionOnFailed);}
function ChkBasketSessionOnSucceeded(result,eventArgs)
{if(result!='')
{RefreshMiniCart(result);}}
function ChkBasketSessionOnFailed(error)
{}
function AddDeliveryCostToCart(DelType,Country)
{Inooga.Inforius.Web.PMS.Cartservice.AddDeliveryCostToCart(DelType,Country,AddDeliveryCostToCartOnSucceeded,AddDeliveryCostToCartOnFailed);}
function AddDeliveryCostToCartOnSucceeded(result,eventArgs)
{RefreshMiniCart(result);}
function AddDeliveryCostToCartOnFailed(error)
{}
function LoadMiniBasket()
{Inooga.Inforius.Web.PMS.Cartservice.LoadMiniBasket(LoadMiniBasketOnSucceeded,LoadMiniBasketOnFailed);}
function LoadMiniBasketOnSucceeded(result,eventArgs)
{RefreshMiniCart(result);}
function LoadMiniBasketOnFailed(error)
{}
function AddGiftVoucherToCart(VoucherVal,VoucherMsg,RecipientFName,RecipientLName,RecipientEmail)
{Inooga.Inforius.Web.PMS.Cartservice.AddVoucherToCart(VoucherVal,VoucherMsg,RecipientFName,RecipientLName,RecipientEmail,AddGiftVoucherToCartOnSucceeded,AddGiftVoucherToCartOnFailed);}
function AddGiftVoucherToCartOnSucceeded(result,eventArgs)
{var Items=result.split('|');if(Items.length>0)
document.location.href=Items[Items.length-1];}
function AddGiftVoucherToCartOnFailed(error)
{}
function AddGiftServiceCostToCart(IncludeGiftService,GiftServiceCharge,ControlParentId)
{if(document.getElementById(ControlParentId+"txtGreeting")!=null)
{Message=encodeURIComponent(document.getElementById(ControlParentId+"txtGreeting").value);}
var Papercode=document.getElementById(ControlParentId+"hdnPaper").value;var Cardcode=document.getElementById(ControlParentId+"hdnCard").value;Inooga.Inforius.Web.PMS.Cartservice.AddGiftServiceCostToCart(IncludeGiftService,GiftServiceCharge,Papercode,Cardcode,Message,AddGiftServiceCostToCartOnSucceeded,AddGiftServiceCostToCartOnFailed);}
function AddGiftServiceCostToCartOnSucceeded(result,eventArgs)
{RefreshMiniCart(result);}
function AddGiftServiceCostToCartOnFailed(error)
{}
function UpdateGiftServiceCardPaperCodeToCart(PCode,CCode,Message,GiftServiceType)
{Inooga.Inforius.Web.PMS.Cartservice.UpdateGiftServiceCardPaperCodeToCart(PCode,CCode,Message,GiftServiceType,UpdateGiftServiceCardPaperCodeToCartOnSucceeded,UpdateGiftServiceCardPaperCodeToCartOnFailed);}
function UpdateGiftServiceCardPaperCodeToCartOnSucceeded(result,eventArgs)
{RefreshMiniCart(result);}
function UpdateGiftServiceCardPaperCodeToCartOnFailed(error)
{}
function ApplyGiftVoucherDiscountToCart() {
   if (document.getElementById("txtVoucherNo") != null) {
        var VoucherNo = document.getElementById("txtVoucherNo").value;
        if (VoucherNo.length > 0)
            Inooga.Inforius.Web.PMS.Cartservice.ApplyGiftVoucherDiscountToCart(VoucherNo, ApplyGiftVoucherDiscountToCartOnSucceeded, ApplyGiftVoucherDiscountToCartOnFailed);
    }    
}
function ApplyGiftVoucherDiscountToCartOnSucceeded(result, eventArgs) {
    if (result != '') {
        var VoucherDisplay = document.getElementById("divIsVoucherReq");
        if (result.indexOf('^') > 0) {
            var Msgresult = result.split('^');
            if (VoucherDisplay != null) {
              VoucherDisplay.innerHTML = Msgresult[0];

            }
            // alert(Msgresult[1]);
            if (Msgresult[1] == "-1") {
                RenderWebshopperAuthorisedControl();

                if (document.getElementById("divCartVoucherCharges") != null) {//alert("2");
                 document.getElementById("divCartVoucherCharges").innerHTML = "";
                }
            }
            else if (Msgresult[1] == "1") {
                RenderWebshopperAuthorisedControl(); SetDeliveryChargeCostOnLoad();
            } 
            else if (Msgresult[1] == "2") {
                RenderRedemmVoucherChargeDisplay(); RenderWebshopperAuthorisedControl(); SetDeliveryChargeCostOnLoad();

            }
            else if (Msgresult[1] == "3") {
                RenderGoodWillVoucherChargeDisplay(); RenderWebshopperAuthorisedControl(); SetDeliveryChargeCostOnLoad();
            }
             
        }   
    }
}
function ApplyGiftVoucherDiscountToCartOnFailed(error)
{}
function RemoveGiftVoucherFromBasketOnSucceeded(result, eventArgs) {
    var VoucherDisplay = document.getElementById("divIsVoucherReq");
      if (result != '') {
          if (result.indexOf('^') > 0) {
              var Msgresult = result.split('^');
              VoucherDisplay.innerHTML = Msgresult[0];


              if (Msgresult[1] == "-1") {}
              else if (Msgresult[1] == "1") {
                  RenderWebshopperAuthorisedControl(); SetDeliveryChargeCostOnLoad();
              } 
              else if (Msgresult[1] == "2") {



                  if (document.getElementById("divCartVoucherCharges") != null) {
                      document.getElementById("divCartVoucherCharges").innerHTML = "";
                  }  SetDeliveryChargeCostOnLoad();
              }
                 
        }       
    }
}
function RemoveGiftVoucherFromBasketOnFailed(error)
{ }
function RefreshMiniCart(result)
{if(result!='')
{var ItemCount=result.split('|');if(ItemCount.length>1)
{if(document.getElementById('divArticle')!=null)
{document.getElementById('divArticle').innerHTML=ItemCount[1];}
if(document.getElementById('divSum')!=null)
{document.getElementById('divSum').innerHTML=ItemCount[0];}
if(ItemCount.length>2)
{if(document.getElementById("divCartTotal")!=null)
document.getElementById("divCartTotal").innerHTML=ItemCount[0];if(document.getElementById("divRabatt")!=null)
document.getElementById("divRabatt").innerHTML=ItemCount[3];if(document.getElementById("divTotalWithRabatt")!=null)
document.getElementById("divTotalWithRabatt").innerHTML=ItemCount[4];if(document.getElementById("divDelCost")!=null)
document.getElementById("divDelCost").innerHTML=ItemCount[5];
if(document.getElementById("divComboCharges")!=null && document.getElementById("divComboDiscount")!=null){
if(ItemCount[8]!="0"){document.getElementById('divComboCharges').className='cart clearfix displayblock';$("#divComboDiscount").attr("innerHTML",ItemCount[8]);}
else{document.getElementById('divComboCharges').className='cart clearfix none';}}
if(document.getElementById("divGiftServiceCost")!=null&&document.getElementById("divGiftServiceCost")!="")
{if(ItemCount[6]!="0")
{document.getElementById('divGeschenkservice').className='rabatt clearfix displayblock';document.getElementById("divGiftServiceCost").innerHTML=ItemCount[6];}
else
{document.getElementById('divGeschenkservice').className='rabatt clearfix none';}}
if(document.getElementById("divTotalCost")!=null)
document.getElementById("divTotalCost").innerHTML="<strong>"+ItemCount[7]+"</strong>";if(document.getElementById("divFinalAmt")!=null)
document.getElementById("divFinalAmt").innerHTML="<strong>"+ItemCount[7]+"</strong>";}}
else
{}}}
function SetDeliveryChargeCostOnLoad()
{Inooga.Inforius.Web.PMS.Cartservice.SetDeliveryCharge(DeliveryChargeCostOnSucceeded,DeliveryChargeCostOnFailed);}
function DeliveryChargeCostOnSucceeded(result,eventArgs)
{RefreshMiniCart(result);}
function DeliveryChargeCostOnFailed(error)
{}
function PopulateData(DivID,MethodName,Parameter,ReviewID)
{var divToBeWorkedOn='#'+DivID;var webMethod='/InforiusShopService/WebShopService.asmx/'+MethodName;var parameters="";if(Parameter!="")
{parameters="{'contextKey':'"+Parameter+"','reviewID':'"+ReviewID+"'}";}
else
{parameters="{}";}
$.ajax({ type: "POST", url: webMethod, data: parameters, contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { $(divToBeWorkedOn).html(msg.d); }, error: function(e) { $(divToBeWorkedOn).html(JScriptRes.GiftEmptyMsg); } });
}
function PopulateDataSearch(DivID,MethodName,Parameter)
{var divToBeWorkedOn='#'+DivID;var webMethod='/InforiusShopService/ShopService.asmx/'+MethodName;var parameters="";if(Parameter!="")
{parameters="{'contextKey':'"+Parameter+"'}";}
else
{parameters="{}";}

$.ajax({type:"POST",url:webMethod,data:parameters,contentType:"application/json; charset=utf-8",dataType:"json",success:function(msg){$(divToBeWorkedOn).html(msg.d);},error:function(e){$(divToBeWorkedOn).html(JScriptRes.GiftEmptyMsg);}});}
function goDetailsPage(link)
{parent.location.href=link;}
function DeleteAllItemsFromWishlist(DivID)
{Inooga.Inforius.Web.PMS.Cartservice.DeleteAllItemsFromWishlist(DivID,DeleteAllItemsFromWishlistOnSucceeded,DeleteAllItemsFromWishlistOnFailed);}
function DeleteAllItemsFromWishlistOnSucceeded(result,eventArgs)
{if(result!='')
{if(document.getElementById(result)!=null)
document.getElementById(result).innerHTML=JScriptRes.ShopServices_NoData;}}
function DeleteAllItemsFromWishlistOnFailed(error)
{}
function fnNewsletterInvalidRefResponse(Msg,TgtUrl)
{var msg="<p class='pop-message' >"+Msg.replace(/[\.]/g,".<br\/>")+"</p>";
//$(function(){$.fancybox({'showCloseButton':false,'autoScale':false,'content':msg,'onComplete':function(){setTimeout('$.fancybox.close()',2000);},'onClosed':function(){window.location.href=TgtUrl;}});});
$.fn.colorbox({html:msg,width:"500px",'onComplete': function() { setTimeout('$.fn.colorbox.close()', 1000); },'onClosed': function() { window.location.href = TgtUrl; }});
}
function fnShowFancyBoxSuccessMessage(Msg, TgtUrl)
{ var msg = "<p class='pop-message' >" + Msg.replace(/[\.]/g, ".<br\/>") + "</p>"; 
//$(function() { $.fancybox({ 'showCloseButton': false, 'autoScale': false, 'content': msg, 'onComplete': function() { setTimeout('$.fancybox.close()', 2000); }, 'onClosed': function() { window.location.href = TgtUrl; } }); }); 
$.fn.colorbox({html:msg,width:"500px",'onComplete': function() { setTimeout('$.fn.colorbox.close()', 1000); },'onClosed': function() { window.location.href = TgtUrl; }});
//$.fn.colorbox({html:msg,width:"500px",'onComplete': function() { setTimeout('$.fn.colorbox.close()', 8000); }});
}
function fnPageRedirect(Msg,TgtUrl)
{window.location.href = TgtUrl;}
function fnContactUsResponse(Msg)
{var msg="<p class='pop-message' >"+Msg.replace(/[\.]/g,".<br\/>")+"</p>";
//$.fn.colorbox({html:msg,width:"500px",'onComplete': function() { setTimeout('$.fn.colorbox.close()', 1000); }});
$.fn.colorbox({html:msg,width:"500px",'onComplete': function() { setTimeout('$.fn.colorbox.close()', 1000); },'onClosed': function() { window.location.href = TgtUrl; }});
}
function fnChangeWebShopper(From)
{window.location.href=From;}
function fnOpenChangeUserDiv(DivID)
{if(document.getElementById(DivID)!=null)
document.getElementById(DivID).style.display='block';}
function SetRequiredFields() {
    if (document.getElementById("hdnIsGiftReq").value == "True")
    { document.getElementById("divIsGiftServiceReq").className = 'cart clearfix displayblock'; }
    else
    { document.getElementById("divIsGiftServiceReq").className = 'cart clearfix none'; }
    if (document.getElementById("hdnIsVoucherReq").value == "True")
    { document.getElementById("divIsVoucherReq").className = 'gutschein clearfix displayblock'; }
    else
    { document.getElementById("divIsVoucherReq").className = 'gutschein clearfix none'; }
	 if (document.getElementById("hdnIsComboDiscReq").value == "True")
    { document.getElementById("divComboCharges").className = 'cart clearfix displayblock'; }
    else
    { document.getElementById("divComboCharges").className = 'cart clearfix none'; }
    if (document.getElementById("hdnIsDelReq").value == "True")
    { document.getElementById("divIsDelReq").className = 'cart clearfix displayblock'; }
    else
    { document.getElementById("divIsDelReq").className = 'cart clearfix none'; }
}
//header script
function changeLogin(item)
{if(document.getElementById['lgnKunden']!=null)
{var str=document.getElementById['lgnKunden'];if(item=='Y')
str.title='Abmelden';else
str.title='Anmelden';}}
//CUSTOM:CST
$(function() {$(".cs25l li").hover(function(){$(this).addClass('over');$(this).removeClass('over');});});

$(document).ready(function() {

	$(".myordercontent").hide();

	$(".myordersheader").toggle(function(){
		$(this).addClass("orderactive");
		}, function () {
		$(this).removeClass("orderactive");
	});

	$(".myordersheader").click(function(){
		$(this).next(".myordercontent").slideToggle("slow,");
	});

});
function chkEnterClick(myfield,txtfieldId,btnfieldId,e)
{
    var key;
    var keychar;
    if (window.event)
	     key = window.event.keyCode;
    else if (e)
	     key = e.which;
    else
	     return true;
    keychar = String.fromCharCode(key);

	if(key==13)
	{
	 //alert("hiii"+myfield.id);
		 var fieldId= myfield.id;
	 var NewbuttonfieldClientId = fieldId.replace(txtfieldId,btnfieldId);
	     return swallowenter(myfield,NewbuttonfieldClientId,e);

	}
	else
	return true;
}

function swallowenter(myfield,btnfieldId,e)
{
       var Btn=document.getElementById(btnfieldId);
       if(Btn != null)
	  return fireEvent(Btn,'click',e);
       else
	  return false;
}
function fireEvent(element,eventname,e)
{
     var EventValue;
     if (document.createEventObject)  // dispatch for IE
     {

       var evt = document.createEventObject();
       evt.keyCode="13";
       EventValue= element.fireEvent('on'+eventname,evt)  // true

     }
     else     // dispatch for firefox + others
     {
	 var evt = document.createEvent("Event");
	 evt.initEvent(eventname, true, true);
	 evt.keyCode="13";
	 EventValue=element.dispatchEvent(evt); // true

     }
       return EventValue;
}

 function RenderWebshopperAuthorisedControl()
    {
	Inooga.Inforius.Web.PMS.Cartservice.RenderWebshopperAuthorisedControl(renderOnSucceeded, renderOnFailed);
    }

    function renderOnSucceeded(result, eventArgs)
    {
       if(document.getElementById('divUCChargeControl')!=null)
            document.getElementById("divUCChargeControl").innerHTML=result;
    }
    function renderOnFailed(error)
    {}
    function CheckGiftVoucherInCart() {
        Inooga.Inforius.Web.PMS.Cartservice.CheckGiftVoucherInCart(ApplyGiftVoucherDiscountToCartOnSucceeded, ApplyGiftVoucherDiscountToCartOnFailed);
    }
    function GetHtmlCartGridAddCharges() {
        Inooga.Inforius.Web.PMS.Cartservice.RenderCartGridAddCharges(RenderCartGridAddChargesOnSucceeded, RenderCartGridAddChargesOnFailed);
    }
    function RenderCartGridAddChargesOnSucceeded(result, eventArgs) {
        if (result != '') {
            if(document.getElementById('divCartAddCharges')!=null)
                document.getElementById("divCartAddCharges").innerHTML = result;
        }
    }
    function RenderCartGridAddChargesOnFailed(error) {    }
    function HtmlCartGridOnLoad() {
        SetRequiredFields(); GetHtmlCartGridAddCharges(); /*SetDeliveryChargeCostOnLoad();*/
		RefreshBasketChargesOnCart();		
		RenderAmazonBlock();
        if (document.getElementById("hdnIsVoucherReq") != null) {
            if (document.getElementById("hdnIsVoucherReq").value == "True") {
                CheckGiftVoucherInCart();}
            else {RenderWebshopperAuthorisedControl();}   
        } 
        
    }
    function LoadBasketCharges() {
        Inooga.Inforius.Web.PMS.Cartservice.RenderOrderConfirmationBasketCharges(RenderOrderConfirmationBasketChargesOnSucceeded, RenderOrderConfirmationBasketChargesOnFailed);
    }
    function RenderOrderConfirmationBasketChargesOnSucceeded(result, eventArgs) {
        if (result != '')
        {
            if(document.getElementById('divBasketCharges')!=null)
                document.getElementById("divBasketCharges").innerHTML = result;
        }
        
    }
    function RenderOrderConfirmationBasketChargesOnFailed(error) {
    }
    function RefreshStuCardPoints() {
        Inooga.Inforius.Web.PMS.Cartservice.RenderStuCard(RefreshStuCardPointsOnSucceeded, RefreshStuCardPointsOnFailed);
    }
    function RefreshStuCardPointsOnSucceeded(result, eventArgs) {
        if (result != '') {
            if(document.getElementById('divStuCard')!=null)
                document.getElementById("divStuCard").style.display = "block";
            if(document.getElementById('spanStuCardPts')!=null)
                document.getElementById("spanStuCardPts").innerHTML = result;
        } else {
            if(document.getElementById('divStuCard')!=null)
                document.getElementById("divStuCard").style.display = "none";
        }
    }
    function RefreshStuCardPointsOnFailed(error) {
    }
    function fnHTMLCartUserChange() {
        var control = document.getElementById("divAlreadyLogin");
        var logincontrol = document.getElementById("divLogin");

        if (control.style.display == "block" || control.style.display == "") {
            control.style.display = "none"; logincontrol.style.display = "block";
        }
        else {
            control.style.display = "block"; logincontrol.style.display = "none";
        }
    }
    function raiseAsyncPostbackForStuCard() {
        if (document.getElementById("divStuCard") != null) { __doPostBack("lnkStu", ""); }
    }
    function ChangeLoginUser() {
        Inooga.Inforius.Web.PMS.Cartservice.FlushUserSessionOnUserChange(ChangeLoginUserOnSucceeded, ChangeLoginUserOnFailed);
    }
    function ChangeLoginUserOnSucceeded(result, eventArgs) {
        fnHTMLCartUserChange();
        if (document.getElementById("hdnIsVoucherReq") != null) {
            if (document.getElementById("hdnIsVoucherReq").value == "True") {
                CheckGiftVoucherInCart();
            }
            else { RenderWebshopperAuthorisedControl(); }
        }
        SetDeliveryChargeCostOnLoad(); raiseAsyncPostbackForStuCard();
         
    }
    function ChangeLoginUserOnFailed(error) {
    }
    function RenderAmazonBlock() {
        if (document.getElementById("divAmazonBlock") != null)
            document.getElementById("divAmazonBlock").innerHTML = "<img src='/Images/animatedBar.gif' border='0' alt='' />";
        Inooga.Inforius.Web.PMS.Cartservice.RenderAmazonBlock(RenderAmazonBlockOnSucceeded, RenderAmazonBlockOnFailed);
    }
    function RenderAmazonBlockOnSucceeded(result, eventArgs) {
        if (result != '') {
            if (document.getElementById("divAmazonBlock") != null)
                document.getElementById("divAmazonBlock").innerHTML = result;
        }
        else if (result == '') {
            if (document.getElementById("divAmazonBlock") != null)
                document.getElementById("divAmazonBlock").innerHTML = result;
        }
    }
    function RenderAmazonBlockOnFailed(error) {
    }
    function RemoveGiftVoucherFromBasket() {
    Inooga.Inforius.Web.PMS.Cartservice.RemoveGiftVoucherFromBasket(RemoveGiftVoucherFromBasketOnSucceeded, RemoveGiftVoucherFromBasketOnFailed);
}
function RenderRedemmVoucherChargeDisplay() {
    Inooga.Inforius.Web.PMS.Cartservice.RenderRedeemVoucherChargeDisplay(RenderRedeemVoucherChargeDisplayOnSucceeded, RenderRedeemVoucherChargeDisplayOnFailed);
}
function RenderRedeemVoucherChargeDisplayOnSucceeded(result, eventArgs) {
    if (result != '') {
        if (document.getElementById("divCartVoucherCharges") != null) {
            document.getElementById("divCartVoucherCharges").innerHTML = result;
        }
    }
}
function RenderRedeemVoucherChargeDisplayOnFailed(error) {}








/****************************************************************************************/



function RenderGoodWillVoucherChargeDisplay() {
    Inooga.Inforius.Web.PMS.Cartservice.RenderGoodWillVoucherChargeDisplay(RenderGoodWillVoucherChargeDisplayOnSucceeded, RenderGoodWillVoucherChargeDisplayOnFailed);
}
function RenderGoodWillVoucherChargeDisplayOnSucceeded(result, eventArgs) {
    if (result != '') {
        if (document.getElementById("divCartVoucherCharges") != null) {
            document.getElementById("divCartVoucherCharges").innerHTML = result;
        }
    }
}
function RenderGoodWillVoucherChargeDisplayOnFailed(error) {
}

function RemoveGoodWillVoucherFromBasket() {
    Inooga.Inforius.Web.PMS.Cartservice.RemoveGoodWillVoucherFromBasket(RemoveGoodWillVoucherFromBasketOnSucceeded, RemoveGoodWillVoucherFromBasketOnFailed);
}

function RemoveGoodWillVoucherFromBasketOnSucceeded(result, eventArgs) {

    var VoucherDisplay = document.getElementById("divIsVoucherReq");
      if (result != '') {
          if (result.indexOf('^') > 0) {
              var Msgresult = result.split('^');
              VoucherDisplay.innerHTML = Msgresult[0];
              if (Msgresult[1] == "-1") {
              }
              else if (Msgresult[1] == "1") {
                  RenderWebshopperAuthorisedControl(); SetDeliveryChargeCostOnLoad();
              } 
              else if (Msgresult[1] == "2") {
              if (document.getElementById("divCartVoucherCharges") != null) {
                  document.getElementById("divCartVoucherCharges").innerHTML = "";
              }  SetDeliveryChargeCostOnLoad();
              }
              else if (Msgresult[1] == "3") {
                  if (document.getElementById("divCartVoucherCharges") != null) {
                      document.getElementById("divCartVoucherCharges").innerHTML = "";
                  }  SetDeliveryChargeCostOnLoad();
              }
              
        }       
      
    }

}
function RemoveGoodWillVoucherFromBasketOnFailed(error)
{ }
function PopupTrigger(id){$("#"+id).trigger('click');}

 jQuery(document).ready(function() {
    $("#frmAdvancedSearch input").live('keypress', function (e) {
    if ($(this).parents('#frmAdvancedSearch').find('a.advnsearch').length <= 0)
    return true;

    if ((e.which && e.which == 13) || (e.keyCode && e.keyCode == 13)) {
    $(this).parents('#frmAdvancedSearch').find('a.advnsearch').click();
 
 return false;
    } else {
  return true;
    }
    });
 $(".advnsearch").click(function () {
submitAdvancedSearch();  });
    });
//For Related Articles
/*Added by subhash on 11-01-2011 for Related Articles*/

jQuery(document).ready(function() { 
    jQuery('.slidebox').hide(); 
    jQuery('.slidelink').click(function() { 
        jQuery(this).next('.slidebox').slideToggle();
 
    }); 
     jQuery('.slide-close').click(function() { 
        jQuery('.slidebox').hide(); 
 
    }); 
}); 
    
    //Function will be called on checked box selected for Type4 articles
    function AddRelatedItemstoCart(ChkId,Ean,Price)
    {
        var totalPrice=document.getElementById('divTotPrice').innerHTML;
        var totalQty=document.getElementById('divTotQuantity').innerHTML;
                
        if($("#"+ChkId).is(":checked"))
        {
            Inooga.Inforius.ShopServices.WebShopService.CalulateTotalPriceForRelatedArticles(String(totalQty),String(Price),String(totalPrice),true,false,false,AddRelatedItemstoCartOnSucceeded, AddRelatedItemstoCartOnFailed);
        }
        else
        {
            Inooga.Inforius.ShopServices.WebShopService.CalulateTotalPriceForRelatedArticles(String(totalQty),String(Price),String(totalPrice),false,false,false,AddRelatedItemstoCartOnSucceeded, AddRelatedItemstoCartOnFailed);
        }    
    }
    //Function will be called for select all and unselect all for Type4 articles
    function RelatedArticlesCheckAndUnCheckAll(TotalPrice,TotalQuantity,ChkState)
    {
      var checked_status = ChkState;
      
      $("input:checkbox[name='RelChk']").each(function(i) {
      this.checked = checked_status;
      });
      
      if(checked_status)
        Inooga.Inforius.ShopServices.WebShopService.CalulateTotalPriceForRelatedArticles(String(TotalQuantity),0,String(TotalPrice),false,true,true,AddRelatedItemstoCartOnSucceeded, AddRelatedItemstoCartOnFailed);
      else
        Inooga.Inforius.ShopServices.WebShopService.CalulateTotalPriceForRelatedArticles(String(TotalQuantity),0,String(TotalPrice),false,true,false,AddRelatedItemstoCartOnSucceeded, AddRelatedItemstoCartOnFailed);
        
    }

    function AddRelatedItemstoCartOnSucceeded(result, eventArgs)
    {
        if (result != '')
        {
            var Msgresult = result.split('|');
            $('#divTotPrice').attr('innerHTML', Msgresult[0]);
            $('#divTotQuantity').attr('innerHTML', Msgresult[1]);
	    $('#divTotPriceTop').attr('innerHTML', Msgresult[0]);
            $('#divTotQuantityTop').attr('innerHTML', Msgresult[1]);
        }
    }
    function AddRelatedItemstoCartOnFailed(error)
    {
    }
    
    function AddAllToCart()
    {
        var val="";
        $("input:checkbox[name='RelChk']").each(function(i) {
            if($(this).is(":checked"))
            { 
                val=val+$(this).attr('id').substring(3,$(this).attr('id').length)+"#"; 
            }
        });
       
        val=val.substring(0,val.length-1);
        AddMultipleItemstoCartFromPopup('1',val);
    }
    
    
    //End Related Articles
    /**********************/
function PopupReview(id)
{
    $("#"+id).trigger('click');
}

function callAddtoCart(eanid)
            {
                var elId = eanid.id;
                var ean = elId.substring(6);
                AddItemstoCart('1',ean);
            }
 function CurrencyLoad(){
        Inooga.Inforius.Web.PMS.Cartservice.GetCurrencyDetails(CurrencyLoadOnSucceeded, CurrencyLoadOnFailed);
    }
    function CurrencyLoadOnSucceeded(result, eventArgs) {
        if (result != '') //Symbol | rate | CartTotal
        {
             var Msgresult = result.split('|');
             if (Msgresult[0] != "" && Msgresult[1] != ""){ 
                CmsGenCurrencyChange(Msgresult[0],Msgresult[1]);
             }
        }
    }
    function CurrencyLoadOnFailed(error) {}
    function ChangeCurrencyDetails(Culture,Symbol)
    {// for changing globalization.
        Inooga.Inforius.Web.PMS.Cartservice.ChangeCurrencyDetails(Culture,CurrencyChangeOnSucceeded, CurrencyChangeOnFailed);
    }
    function CurrencyChangeOnSucceeded(result, eventArgs) {
        if (result != '') //Symbol | rate | CartTotal
        {
            var Msgresult = result.split('|');
             if (Msgresult[0] != "" && Msgresult[1] != ""){ 
                CmsGenCurrencyChange(Msgresult[0],Msgresult[1]);
             }
           //GetCartTotalForCurrentCulture();
           if (Msgresult[2] != ""){ 
            $("#divSum").attr("innerHTML",Msgresult[2]);
           }
        }
    }
    function CurrencyChangeOnFailed(error) {}
    function CmsGenCurrencyChange(Symbol,CultureRate)
    {
	    //for replacing currency Symbol
	    $("span.spSymbol").each(function() { this.innerHTML=  Symbol; });
	    //For recalcullating price with currency rate & original price
	    $("span.spPrice").each(function() { 
		    var spOriginalPrice=$(this).parent().children("span.spOriginalPrice");
		    var OriginalPrice= $(spOriginalPrice)[0].innerHTML;
		    var amount=OriginalPrice * CultureRate
		    this.innerHTML= amount.toFixed(2);
	    });
    }       
            
function download(link)
{
    window.location.href=link;
}
function SendDownloadReq(DigitalId,OrderCode,OdetCode)
{
    Inooga.Inforius.Web.PMS.Cartservice.GetEBookDownLoadLink(DigitalId,OrderCode,OdetCode,SendDownloadReqOnSucceeded, SendDownloadReqOnFailed);
}
function SendDownloadReqOnSucceeded(result, eventArgs) {
    if (result != '' || result != 'NULL') {
        var Msgresult = result.split('^');
        if(Msgresult[0]==""){
            var msg="<p class='pop-message' >"+Msgresult[1]+"</p>";
            $.fn.colorbox({html:msg,width:"600px"});
        }else{
            window.location.href=Msgresult[0];
        }    
    }
}
function SendDownloadReqOnFailed(error){}

	function RefreshBasketChargesOnCart()
    {Inooga.Inforius.Web.PMS.Cartservice.RefreshBasketChargesOnCart(RefreshBasketChargesOnCartOnSucceeded,RefreshBasketChargesOnCartOnFailed);}
    function RefreshBasketChargesOnCartOnSucceeded(result,eventArgs)
    {RefreshMiniCart(result);}
    function RefreshBasketChargesOnCartOnFailed(error){}
	
function RenderComboDiscountChargeDisplay() {
    Inooga.Inforius.Web.PMS.Cartservice.RenderComboDiscountChargeDisplay(RenderComboDiscountChargeDisplayOnSucceeded, RenderComboDiscountChargeDisplayOnFailed);
}
function RenderComboDiscountChargeDisplayOnSucceeded(result, eventArgs) {
    if (result != '') {$("#divComboCharges").attr("innerHTML",result);}else{$("#divComboCharges").attr("innerHTML","");}
}
function RenderComboDiscountChargeDisplayOnFailed(error) {}



jQuery(document).ready(function() { 
$("ul.verlist div").addClass("clearfix");
}); 
