var mp3_playingId="";function mp3player_startPlay(a){if(""!=mp3_playingId&&mp3_playingId!=a){var b=getFlashMovieObject(mp3_playingId);b.mp3player_stopPlay();}mp3_playingId=a;}function getFlashMovieObject(a){if(window.document[a]){return window.document[a];}if(navigator.appName.indexOf("Microsoft Internet")==-1){if(document.embeds&&document.embeds[a]){return document.embeds[a];
}}else{return document.getElementById(a);}}var InputSelector=Class.create();InputSelector.prototype={initialize:function(e,h,f,i,g,b,j,a,d,c){this.top=1;this.bottom=0.4;this.max=11;this.isCheckAllButtonVisible=true;this.version="InputSelector";this.fakeOuter=e;this.fakeInner=h;this.realInput=f;this.listOfValues=i;
this.selectedListOfValues=$H(g);this.popupInputs=$A();this.popup=b||this.createPopupContainer(0,200);this.popupIframe=this.createPopupIframeContainer(0,200);this.popupAutoListener();this.doAjax=true;this.view=j||{width:150,count:1};this.searchUrl=a;this.form=d;this.formOuter=c;this.setUpListeners();this.startHTML=this.fakeInner.innerHTML;
this.drawSelectorInput();},setUpListeners:function(){this.fakeOuter.observe("click",function(){if(this.popup.getStyle("display")=="none"){if(this.doAjax){this.createWaitingEffect(this.top,this.bottom);this.createAjaxQuery();}else{this.drawPopUpElement(this.fakeOuter,this.view);this.drawSelectorInput();
}}else{this.popup.hide();}}.bindAsEventListener(this));},drawSelectorInput:function(){var b="";var c=this.selectedListOfValues.keys();this.realInput.value="";for(var a=0;a<c.length;a++){b+=this.selectedListOfValues.get(c[a])+", ";this.realInput.value+=c[a]+",";}this.fakeInner.setAttribute("title",b);
if(b.length>this.max){b=b.substr(0,this.max)+" ...";}else{if(b==""){b=this.startHTML;}}this.fakeInner.innerHTML=b;},createAjaxQuery:function(){new Ajax.Request(this.searchUrl["url"]+this.searchUrl["param_prefix"]+this.searchUrl["param_value"],{onComplete:function(a){this.doAjax=false;this.listOfValues=$H(a.responseText.evalJSON());
this.drawPopUpElement(this.fakeOuter,this.view);this.createAfterFinishEffect(this.bottom,this.top);this.drawSelectorInput();}.bindAsEventListener(this)});},createWaitingEffect:function(b,a){this.toggleLoading(true);new Effect.Opacity(this.formOuter,{from:b,to:a,duration:0.2});},createAfterFinishEffect:function(b,a){new Effect.Opacity(this.formOuter,{from:b,to:a,duration:0.2});
this.toggleLoading(false);},toggleLoading:function(a){if(this.loader==null){this.loader=new Element("img",{src:"/images/ajax-loader.gif",className:"searchLoader"});this.formOuter.appendChild(this.loader);}if(a){this.loader.show();}else{this.loader.hide();}},rowListener:function(a){}.bindAsEventListener(this),setUpOnUpdateListener:function(a){this.onUpdateListener=a;
},createPopupContainer:function(a,d){var b=$("inputSelectorDivId");if(b){return b;}var c=new Element("div",{id:"inputSelectorDivId",style:"display:none;"+"z-index:1001;"+"position:absolute;"+"left:"+a+"px;"+"top:"+d+"px;"});document.body.appendChild(c);c.addClassName("search_elem_over");return c;},createPopupIframeContainer:function(a,d){var c=$("inputSelectorIframeId");
if(c){return c;}var b=new Element("iframe",{id:"inputSelectorIframeId",style:"position:absolute; "+"z-index:1000;"+"display:none;"+"padding:0;margin:0;"+"background:white;"+"left:"+a+"px;"+"top:"+d+"px;"+"border:0",src:"/flash/blank.html"});document.body.appendChild(b);return b;},setSelectedList:function(){this.popupInputs=$A(this.popup.select("input"));
this.popupInputs.each(function(a){if(a.checked){this.selectedListOfValues.set(a.value,this.listOfValues.get(a.value));this.drawItemListText(a.value,"disabled");}else{this.selectedListOfValues.unset(a.value);if(a.disabled){this.drawItemListText(a.value,"disabled",true);}else{this.drawItemListText(a.value,"disabled");
}}}.bindAsEventListener(this));this.drawSelectorInput();},clearSelections:function(){this.selectedListOfValues=$H();this.drawSelectorInput();},drawItemListText:function(c,b,a){if(a){$("span_"+c).addClassName(b);}else{$("span_"+c).removeClassName(b);}},drawPopUpElement:function(c,b){b["count"]=b["count"]||1;
b["width"]=b["width"]||220;this.popup.setStyle({width:(b["count"]*b["width"]+2)+"px"});var e="";e+=this.drawMenu();e+="<div class='inner_over'> ";e+=this.drawInputList(b);e+="<div class='clearing'> </div>";e+="</div>";this.popup.hide();this.popupIframe.hide();this.popup.update(e);this.setMenuListener();
this.popupInputs=$A(this.popup.select("input"));this.popupInputs.each(function(f){f.observe("click",function(){this.rowListener(f);this.setSelectedList();}.bindAsEventListener(this));}.bindAsEventListener(this));var a=this.getOffset($(c));var d=$(c).getHeight();this.popup.setStyle({top:(a["top"]+d+2)+"px",left:(a["left"]+1)+"px"});
this.popupIframe.setStyle({top:(a["top"]+d+2)+"px",left:(a["left"]+1)+"px",width:(b["count"]*b["width"]+2)+"px",height:(this.popup.getHeight()+2)+"px"});Effect.BlindDown(this.popup);Effect.BlindDown(this.popupIframe);},getOffset:function(b){var a=0,c=0;do{if(b.id!="header"&&b.id!="global"){a+=b.offsetTop||0;
}c+=b.offsetLeft||0;b=b.offsetParent;}while(b);return Element._returnOffset(c,a);},drawMenu:function(){this.menu_template="selector_template_menu";this.menu=$(this.menu_template);var a=this.menu.innerHTML;return a;},setMenuListener:function(){var a=this.isCheckAllButtonVisible;var e=this.popup.select(".bordered_bottom")[0];
var d=$(e.select(".close")[0]);d.observe("click",function(){this.popup.hide();this.popupIframe.hide();}.bindAsEventListener(this));var c=$(e.select(".none")[0]);c.observe("click",function(){this.uncheckAllAdditionalListener();this.uncheckAllListener();this.setSelectedList();}.bindAsEventListener(this));
var b=$(e.select(".all")[0]);b.setStyle({display:(a)?"":"none"});b.observe("click",function(){this.checkAllListener();this.setSelectedList();}.bindAsEventListener(this));},uncheckAllListener:function(){this.selectedListOfValues=$H();this.drawSelectorInput();this.popupInputs.each(function(a){a.checked=false;
a.disabled=false;});},uncheckAllAdditionalListener:function(){},checkAllListener:function(){this.selectedListOfValues=this.listOfValues;this.drawSelectorInput();this.popupInputs.each(function(a){a.checked=true;a.disabled=false;});},drawInputList:function(a){var c="";var b="";var d="";$A(this.listOfValues).each(function(e){b="";
d="";c+="<span class='item'>";if(this.selectedListOfValues.get(e.key)){b=" checked='checked' ";}else{if(this.setDisabled(e.key)){b+=" disabled='true' ";d=" class='disabled'";}}c+="<input type='checkbox' value='"+e.key+"'"+b+" name='"+e.value+"_"+e.key+"'/> ";c+="<span"+d+' id="span_'+e.key+'">';c+=e.value;
c+="</span>";c+="</span>";}.bindAsEventListener(this));return c;},setDisabled:function(a){return false;},isAllUnChecked:function(){return true;},popupAutoListener:function(){this.popupListening();this.windowListening();},windowListening:function(){Event.observe(document.body,"click",function(a){a.cancelBubble=false;
this.popup.hide();this.popupIframe.hide();}.bindAsEventListener(this));},popupListening:function(){Event.observe(this.popup,"click",function(a){a.cancelBubble=true;}.bindAsEventListener(this));},showVersion:function(){window.alert(this.version);}};var ProductAndCategorySearchSelector=Class.create();ProductAndCategorySearchSelector.prototype={initialize:function(d,e,b,a,c){this.linked=$H(e);
this.searchUrl=d;this.currentProduct=$H(c["product"]).keys()[0]||1;this.products=$H();this.categories=$H();this.selectedProducts=$H(c["product"])||$H();this.selectedCategories=$H(c["category"])||$H();this.linked.each(function(f){this.categories.set(f.value,$H());}.bind(this));this.params={category:"?value=categories&id=",product:"?value=products"};
this.productSelector=new InputSelector($(b.outer_id),$(b.inner_id),$(b.outer_id).select("input")[0],this.products,this.selectedProducts,null,{count:1,width:220},{url:this.searchUrl,param_prefix:this.params.product,param_value:""},$(b.inner_form),$(b.outer_form));this.productSelector.rowListener=this.rowListener;
this.productSelector.setDisabled=this.setDisabled;this.productSelector.isAllUnChecked=this.isAllUnChecked;this.productSelector.uncheckAllAdditionalListener=this.uncheckAllAdditionalListener;this.productSelector.isCheckAllButtonVisible=false;this.categorySelector=new InputSelector($(a.outer_id),$(a.inner_id),$(a.outer_id).select("input")[0],this.categories.get(this.linked.get(this.currentProduct)),this.selectedCategories,null,{count:4,width:160},{url:this.searchUrl,param_prefix:this.params.category,param_value:this.currentProduct},$(a.inner_form),$(a.outer_form));
this.productSelector.categories=this.categories;this.productSelector.linked=this.linked;this.productSelector.categorySelector=this.categorySelector;this.productSelector.baseProduct="1";this.productSelector.baseCategoryOfProduct=this.linked.get(this.productSelector.baseProduct);this.productSelector.selectedProduct=this.currentProduct;
this.productSelector.selectedCategoryOfProduct=this.linked.get(this.currentProduct);},uncheckAllAdditionalListener:function(){this.selectedProduct=this.baseProduct;this.selectedCategoryOfProduct=this.baseCategoryOfProduct;var c=this.categorySelector.listOfValues.keys().length==this.categories.get(this.selectedCategoryOfProduct).keys().length;
if(c){for(var b=0;b<this.categorySelector.listOfValues.keys();b++){var a=this.categorySelector.listOfValues.keys()[b];c=this.categorySelector.listOfValues.get(a)==this.categories.get(this.selectedCategoryOfProduct).get(a);if(!c){break;}}}this.categorySelector.searchUrl["param_value"]=this.selectedProduct;
this.categorySelector.listOfValues=this.categories.get(this.selectedCategoryOfProduct);if(!c){this.categorySelector.uncheckAllListener();}},setDisabled:function(a){if(this.selectedListOfValues.keys().length>0){return !(this.linked.get(a)==this.linked.get(this.selectedProduct));}else{return false;}},isAllUnChecked:function(){var b=true;
for(var a=0;a<this.popupInputs.length;a++){if(this.popupInputs[a].checked){b=false;break;}}return b;},rowListener:function(b){var c=this.selectedCategoryOfProduct;this.categories.set(c,this.categorySelector.listOfValues);this.selectedProduct=b.value;this.selectedCategoryOfProduct=this.linked.get(this.selectedProduct);
if(this.isAllUnChecked()){for(var a=0;a<this.popupInputs.length;a++){this.popupInputs[a].disabled=false;}this.selectedProduct=this.baseProduct;this.selectedCategoryOfProduct=this.baseCategoryOfProduct;}else{for(var a=0;a<this.popupInputs.length;a++){this.popupInputs[a].disabled=this.linked.get(this.popupInputs[a].value)!=this.linked.get(this.selectedProduct);
}}this.categorySelector.searchUrl["param_value"]=this.selectedProduct;this.categorySelector.doAjax=this.categories.get(this.selectedCategoryOfProduct).keys().length==0;this.categorySelector.listOfValues=this.categories.get(this.selectedCategoryOfProduct);if(c!=this.selectedProduct){this.categorySelector.uncheckAllListener();
}},createPopupContainer:function(a,c){var b=new Element("div",{style:"display:none;"+"position:absolute;"+"left:"+a+"px;"+"top:"+c+"px;"});document.body.appendChild(b);b.addClassName("search_elem_over");return b;}};var HeaderProductAndCategorySearchSelector=Class.create(ProductAndCategorySearchSelector);
var AdvansedProductAndCategorySearchSelector=Class.create(ProductAndCategorySearchSelector);var AuthorSearchSelector=Class.create();AuthorSearchSelector.prototype={initialize:function(a,c,b){this.authors=$H();this.searchUrl=a;this.selectedAuthors=$H(c)||$H();this.authorSelector=new InputSelector($(b.outer_id),$(b.inner_id),$(b.outer_id).select("input")[0],this.authors,this.selectedAuthors,null,{count:4,width:160},{url:this.searchUrl,param_prefix:"?value=authors",param_value:""},$(b.inner_form),$(b.outer_form));
}};var LeftCategoryToggle=Class.create();LeftCategoryToggle.prototype={initialize:function(b,a){this.products=b;this.options=Object.extend(this.prepareElementsIdsNames(),a);this.product={};this.no_empty={};this.toggle={};this.toggleAll={};$A(this.products).each(function(c){this.prepareAllListsForProduct(c);
}.bind(this));$A(this.products).each(function(c){this.attachObservers(c);}.bind(this));this.setupAllGroups();},setupAllGroups:function(){if(this.options.currentProduct!=""){setCookie("left_product_"+this.options.currentProduct,"all");}},prepareElementsIdsNames:function(){return{currentProduct:"",productGroup:{prefix:"product",suffix:"_group"},noEmptyGroup:{prefix:"no_empty_product",suffix:"_group"},toggleAll:{prefix:"product",open_suffix:"_open_all",close_suffix:"_close_all"},toggle:{prefix:"product",open_suffix:"_open",close_suffix:"_close"}};
},prepareAllListsForProduct:function(a){this.product[a]=$(this.options.productGroup["prefix"]+a+this.options.productGroup["suffix"]);this.toggle[a]={};this.toggleAll[a]={};try{this.no_empty[a]=$(this.options.noEmptyGroup["prefix"]+a+this.options.noEmptyGroup["suffix"]);this.toggle[a]["close"]=$(this.options.toggle["prefix"]+a+this.options.toggle["close_suffix"]);
this.toggle[a]["open"]=$(this.options.toggle["prefix"]+a+this.options.toggle["open_suffix"]);}catch(b){}this.toggleAll[a]["close"]=$(this.options.toggleAll["prefix"]+a+this.options.toggleAll["close_suffix"]);this.toggleAll[a]["open"]=$(this.options.toggleAll["prefix"]+a+this.options.toggleAll["open_suffix"]);
},attachObservers:function(a){this.attachObserversForTopToggleButton(a);this.attachObserversForBottomToggleButton(a);},attachObserversForTopToggleButton:function(a){this.toggleAll[a]["close"].observe("click",function(){Effect.BlindUp(this.product[a],{duration:0.2});this.toggleAll[a]["close"].hide();this.toggleAll[a]["open"].show();
try{this.toggle[a]["open"].hide();this.toggle[a]["close"].hide();}catch(b){}setCookie("left_product_"+a,"none");}.bind(this));this.toggleAll[a]["open"].observe("click",function(){if(this.product[a].getStyle("display")=="none"){try{this.no_empty[a].show();this.toggle[a]["close"].show();}catch(b){}Effect.BlindDown(this.product[a],{duration:0.2});
}else{try{if(this.no_empty[a].getStyle("display")=="none"){this.toggle[a]["close"].show();Effect.BlindDown(this.no_empty[a],{duration:0.2});}}catch(b){}}this.toggleAll[a]["open"].hide();this.toggleAll[a]["close"].show();try{this.toggle[a]["open"].hide();this.toggle[a]["close"].show();}catch(b){}setCookie("left_product_"+a,"all");
}.bind(this));},attachObserversForBottomToggleButton:function(b){try{this.toggle[b]["close"].observe("click",function(){Effect.BlindUp(this.no_empty[b],{duration:0.2});this.toggle[b]["close"].hide();this.toggleAll[b]["close"].hide();this.toggleAll[b]["open"].show();setCookie("left_product_"+b,"",-1);
}.bind(this));this.toggle[b]["open"].observe("click",function(){Effect.BlindDown(this.no_empty[b],{duration:0.2});this.toggle[b]["open"].hide();this.toggle[b]["close"].show();this.toggleAll[b]["open"].hide();this.toggleAll[b]["close"].show();setCookie("left_product_"+b,"all");}.bind(this));}catch(a){}}};
var LanguageToggle=Class.create();LanguageToggle.prototype={initialize:function(c,a,b){this.buttonBuy=$(c);this.list=$(a);this.corners=$(b);$(this.list).setStyle({display:"none"});this.attachObservers();},attachObservers:function(){this.attachObserverToButton();this.attachObserverToBody();},attachObserverToBody:function(){Event.observe(document.body,"click",function(a){a.cancelBubble=false;
this.closeList();}.bindAsEventListener(this));},attachObserverToButton:function(){if($(this.list).childElements().length>0){$(this.buttonBuy).observe("click",function(a){if(this.list.getStyle("display")=="none"){this.openList();}else{this.closeList();}}.bindAsEventListener(this));}},openList:function(){this.corners.hide();
Effect.SlideDown(this.list,{duration:0.2});},closeList:function(){this.list.hide();this.corners.show();}};var ItemTooltipList=Class.create({initialize:function(b,a,c){this.items=$$("."+b);this.descriptionItems=$$("."+a);this.host=c||"";var d=0;$A(this.items).each(function(e){this.setBigPreview(e,d);d++;
}.bind(this));$A(this.descriptionItems).each(function(e){this.setAjaxPreview(e);}.bind(this));},setAjaxPreview:function(a){var b="<img src='/images/groupview-loader.gif'/> Loading ...";new ToolTip(a,b,{className:"darktip"},this.host+"/service/jsonPopup.do?type=groupview&viewId="+a.getAttribute("viewid"));
},setBigPreview:function(b,h){try{var d=b.getAttribute("name").evalJSON();var g="";var a;g+="<p class='bold align_center' style='width:"+d[0]+"px'>"+d[2]+" #"+d[3]+"</p>";g+="<div class='loading_preview' id='line_"+h+"-"+d[3]+"'>Loading...<br/><div class='loading_out'><div class='loading_in' style='width:50px;'> </div></div></div>";
g+="<div class='align_center'  style='width:"+d[0]+"px;height:"+d[1]+"px;'><img onload=\"clearInt()\" src='"+d[4]+"' alt='"+d[5]+"' title='"+d[6]+"'/></div>";var c=new ToolTip(b,g,{className:"image_preview",delay:2000});c.onStartAction=function(){loader("loading_in","loading_out","line_"+h+"-"+d[3]);
};c.onOutAction=function(){clearInt();};}catch(f){}}});var inner_loading;var outer_loading;var full_loading;var timer;function loader(c,b,a){try{full_loading=$(a);inner_loading=$$("#"+a+" ."+c)[0];outer_loading=$$("#"+a+" ."+b)[0];full_loading.style.display="";timer=setInterval("move()",30);}catch(d){}}function move(){try{if(inner_loading.offsetLeft>=outer_loading.clientWidth){inner_loading.style.left="-"+inner_loading.getStyle("width");
}else{inner_loading.style.left=(inner_loading.offsetLeft+6)+"px";}}catch(a){}}function clearInt(){try{full_loading.style.display="none";inner_loading.style.left="-"+inner_loading.style.width;clearInterval(timer);}catch(a){}}var DownloadList=Class.create({initialize:function(e,d,b,c,a){this.messages=$H(e);
this.autoRefresh=a;this.doTooltips();this.url=b;this.template=new Template(c.innerHTML,/(^|.|\r|\n)(\#\s*(\w+)\s*#)/);this.forAjaxItems=$$("."+d);this.timer={};this.doAjax();},doTooltips:function(){this.messages.each(function(b){var a="."+b.key;this.items=$$(a);var c=$(b.value).innerHTML;$A(this.items).each(function(d){new ToolTip(d,c,{className:"darktip"});
}.bind(this));}.bind(this));},doAjax:function(){var a=1000*this.autoRefresh;this.timer=setInterval(function(){this.doAjaxItems();}.bind(this),a);},doAjaxItems:function(){var b=new Array();var a=0;$A(this.forAjaxItems).each(function(c){b[a++]=c.id;}.bind(this));if(b.length>0){new Ajax.Request(this.url,{method:"post",parameters:{"ids":b.toJSON()},onComplete:function(c){this.onCompleteItems(c.responseText.evalJSON());
}.bindAsEventListener(this)});}},onCompleteItems:function(a){$A(a).each(function(c){var b="";c["closePassword"]="";if(c["error"]!=null){Window.location="/";}else{if(c["archivePassword"]==null||c["archivePassword"]==""||c["archivePassword"]=="empty"){c["closePassword"]="display_none";}b=this.template.evaluate(c);
$(c["id"]).update(b);}}.bind(this));}});var TransactionStatusRefresher=Class.create({initialize:function(c,d,b,a){this.operationId=c;this.timeout=d;this.status=a;this.url=b;this.timer={};this.startTimer();},startTimer:function(){var a=1000*this.timeout;this.timer=setInterval(function(){this.onTimer();
}.bind(this),a);},setInitialText:function(a){if((a=="Purchases Approved"||a=="Subscription")&&$("orderInfoText")){this.setVisibleElement(false,"orderInfoText");}},onTimer:function(){new Ajax.Request(this.url,{method:"post",parameters:{"operationId":this.operationId,"status":this.status},onComplete:function(a){this.onRequest(a.responseText.evalJSON());
}.bindAsEventListener(this)});},onRequest:function(a){if(a["error"]!=null){window.location="/";}else{if(a["status"]!=this.status){this.status=a["status"];this.setInitialText(this.status);if(a["view"]!=null){$(this.operationId).update(a["view"]);}if(a["topText"]!=null){$("topText").update(a["topText"]);
}if(a["bottomText"]!=null){$("bottomText").update(a["bottomText"]);}fix_height_for_ie6("finances_transact_block");}if((a["isContinue"]!=null)&&(a["isContinue"]=="false")){clearInterval(this.timer);}}},setVisibleElement:function(b,a){if(b){document.getElementById(a).style.display="block";}else{document.getElementById(a).style.display="none";
}}});var ComplectationList=Class.create({initialize:function(d,h,g,e,f,a,b,c){this.prefixUrl=d;this.prefix=h;this.list=$$("."+g);this.total=(e=="")?e:$(e);this.balance=(f=="")?f:$(f);this.balanceAfter=(a=="")?a:$(a);this.purchaseLink=(b=="")?b:$(b);this.outer=$(c);$A(this.list).each(function(i){i.onclick=function(){this.waitingEffect();
this.remove(i.title);return false;}.bindAsEventListener(this);}.bind(this));},waitingEffect:function(){new Effect.Opacity(this.outer,{from:1,to:0.2,duration:0.2});if(this.loader==null){this.loader=new Element("img",{src:"/images/ajax-loader.gif",style:"position:absolute; top:50%;left:50%; display:block;margin-left:-25px;margin-top:-12px;"});
this.outer.appendChild(this.loader);}this.loader.show();},remove:function(a){new Ajax.Request(this.prefixUrl+a+".html",{onComplete:function(b){this.onRemoveComplete(b.responseText,a);this.endEffect();}.bindAsEventListener(this),onFailure:function(){this.endEffect();}.bindAsEventListener(this)});},onRemoveComplete:function(a,c){if(a.empty()){window.location.reload();
}else{try{var b=a.evalJSON(true);if(this.total){this.total.update(b.total);}if(this.balance){this.balance.update(b.balance);}if(this.balanceAfter){this.balanceAfter.update(b.balanceAfter);}if(this.purchaseLink){this.purchaseLink.href=b.purchaseLink;}}catch(d){}$(this.prefix+c).remove();}},endEffect:function(){this.loader.hide();
new Effect.Opacity(this.outer,{from:0.2,to:1,duration:0.2});}});var PriceTable=Class.create({initialize:function(c,e,f,d,b,a){this.outer=c;if(!$(this.outer)){return;}this.block=$(e);this.popupList=$$("."+d);this.url=b;this.trs=$A($(this.outer).select("tr"));this.trs=this.trs.without(this.trs[0]);this.radios=Form.getInputs($(this.outer),"radio",f);
this.popupListener();this.rowListener();},popupListener:function(){$A(this.popupList).each(function(a){var b="<img src='/images/groupview-loader.gif'/> Loading ...";new ToolTip(a,b,{className:"darktip"},this.url+"?viewId="+a.getAttribute("viewid"));}.bindAsEventListener(this));},rowListener:function(){for(var a=0;
a<this.trs.length;a++){var b=this.trs[a];b.observe("click",function(e){e.select("input")[0].checked=true;var c=$A(this.trs).indexOf(e);var d=0;this.trs.each(function(g){var f="selected-price";if(d==c){$(g).addClassName(f);}else{$(g).removeClassName(f);}d++;});fix_height_for_ie6(this.block);}.bind(this,b));
}},getRadioValue:function(b){try{return b.find(function(c){return c.checked;}).value;}catch(a){}return null;}});function emailChecking(b){var c=/^[\w\-\'\~\_\.\*\/=\^\{\}\?\+\!\#\$\%\&\`\|]+[\@][\w\_\.\-]+[\.][\w]{2,6}$/i;if((b=="")||(b.length>100)||(c.exec(b)==null)||(b.substr(b.lastIndexOf("@")+1,1)==".")){return false;
}var a=b.substring(0,b.indexOf("@"));if((b.indexOf("..")>0)||(a[0]==".")||(a[a.length-1]==".")){return false;}return true;}function onClickPreSubscribe(){try{var a=$("subscribeFormEmail");var b={};b["invalid"]=$("subscribeFormEmailInvalid");b["empty"]=$("subscribeFormEmailEmpty");if(a.value.empty()){b["empty"].style.display="";
b["invalid"].style.display="none";}else{if(emailChecking(a.value)){b["empty"].style.display="none";b["invalid"].style.display="none";$("subscribeForm").submit();}else{b["invalid"].style.display="";b["empty"].style.display="none";}}fix_height_for_ie6("subscribeFormBlock");return false;}catch(c){}}function onClickSubscribe(){try{var d=$("confirmCheckBox");
var c=$("onClickSubscribeSubmit");var b=false;var a='<img src="/images/check.gif" style="margin-top:-1px;"/>';try{d.observe("click",function(e){if(b){b=false;d.innerHTML="";}else{b=true;d.innerHTML=a;d.removeClassName("error_checkbox");}});}catch(f){alert(f);}try{c.onclick=function(){if(b){$("subscribeForm").submit();
return false;}else{d.addClassName("error_checkbox");}};}catch(f){alert(f);}}catch(f){}}function getElementHeight(b){var c=0;var d=b.childNodes;for(var a=0;a<d.length;a++){if(d[a].id!="left"&&d[a].id!="footer"&&d[a].id!="about_us_text"){c=c+d[a].offsetHeight;}}if(navigator.userAgent.indexOf("MSIE")!=-1){if(document.getElementById("flashPlayer-membership")){c=c-22;
}else{c=c-17;}}return c;}function calculateHeight(){if($("aboutBlock")&&($("aboutBlock").style.display="none")){var a=$("shoppingCart").offsetHeight;$("aboutBlock").style.display="block";$("aboutBlock").style.position="absolute";$("aboutBlock").style.top=a+20+"px";$("aboutBlock").style.marginRight=15+"px";
var c=$("aboutBlock").offsetHeight;var b=$("contentBlock").offsetHeight;var d=c+a;if(b<d){$("content").style.height=d+30+"px";}else{$("content").style.height=b+20+"px";}}}var AjaxLoader=Class.create();AjaxLoader.prototype={initialize:function(){this.loader=new Element("img",{src:"/images/ajax-loader.gif"});
this.loader_width=400;this.container=new Element("div");this.container.className="ajaxloader";this.container.id="loader-container";this.container.appendChild(this.loader);this.textBlock=new Element("div");this.textBlock.className="loader-text";this.textBlock.innerHTML="Loading, please wait...";this.container.appendChild(this.textBlock);
document.body.appendChild(this.container);},show:function(){var f=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft||0;var e=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop||0;var a=window.innerHeight||document.documentElement.clientHeight;
var c=a/2+e;this.container.style.top=c+"px";var b=window.innerWidth||document.documentElement.clientWidth;var d=(b/2+f)-this.loader_width/2;this.container.style.left=d+"px";this.container.setOpacity(1);this.container.style.display="block";},hide:function(a){if(arguments.length==0){a=2;}Effect.Fade(this.container,{duration:a});
}};var Cart=Class.create();Cart.prototype={initialize:function(){this.not_enough_credits_id="not_enough_credits";this.loader=new AjaxLoader();this.itemsCount=0;},addToCart:function(b){var a=this;this.loader.show();new Ajax.Request("/cart-add-"+b+".html",{method:"post",onComplete:function(f){var e=f.responseText.evalJSON();
a.itemsCount=e.cartItemsCount;$(b).innerHTML=locales["added_to_cart"];$(b).className="in_cart";var d=$("cart_list");if(d==null){$("empty_cart_note").remove();a.createCartTable();}$("cart_list").getElementsByTagName("tbody")[0].appendChild(this.createCartRow(e.item));var c=$("total_cart");if(c==null){c=new Element("div");
c.id="total_cart";c.className="total_cart";$("cartBlock").appendChild(c);}c.innerHTML=locales["cart_message_total"].replace("{0}",e.total_in_cart);a.addAlertMessage(e.userMembershipState);a.updateDownloadButton(e);calculateHeight();this.loader.hide();}.bindAsEventListener(this)});},removeFromCart:function(b){var a=this;
this.loader.show();new Ajax.Request("/cart-remove-"+b+".html",{method:"post",onComplete:function(g){var d=g.responseText.evalJSON();a.itemsCount=d.cartItemsCount;$(b+"-r").remove();var c=$("cart_list");var e=c.getElementsByTagName("tr");var f=$("total_cart");if(a.itemsCount==0){a.clearCartList();}else{f.innerHTML=locales["cart_message_total"].replace("{0}",d.total_in_cart);
a.addAlertMessage(d.userMembershipState);}a.appendAddToCartButton(d.item);a.updateDownloadButton(d);calculateHeight();this.loader.hide();}.bindAsEventListener(this)});},updateDownloadButton:function(a){var b=false;var c=$("download_button");if(c==null){c=new Element();c.setAttribute("id","download_button");
c.setAttribute("class","button");c.setAttribute("rel","nofollow");b=true;}if(a.cartItemsCount!=0){switch(a.userMembershipState){case"DOWNLOADS_ALLOWED":c.setAttribute("href","/user_profile/buy_cart.jhtml");break;case"NO_MEMBERSHIP":c.setAttribute("href",buyMembershipLink);break;case"NO_USER":c.setAttribute("href",loginLink);
c.onclick=function(){return wac_ajax_popup(this.href,"Log In");};break;default:c.onclick="";c.setAttribute("href","#");break;}}if(b){$("buttons").appendChild(c);}},addAlertMessage:function(a){if(a=="NOT_ENOUGH_DOWNLOAD_POINTS"&&$(this.not_enough_credits_id)==null){var b=new Element("p");b.id=this.not_enough_credits_id;
b.className="note";b.innerHTML=locales["not_enough_credits"];$("total_cart").appendChild(b);}},createCartTable:function(){var a=new Element("tbody");var b=new Element("table",{id:"cart_list",cellspacing:"0",cellpadding:"0"});b.appendChild(a);$("cartBlock").appendChild(b);},createCartMessage:function(){var a=new Element("div",{id:"empty_cart_note"});
a.appendChild(document.createTextNode(locales["empty_cart_note"]));return a;},createFlashPlayer:function(c){var e="flashPlayer-cart-"+c.itemNumber;var a="/flash/player_small.swf?trackPath="+c.imageSmallUrl+"&playerID="+e;var b=new Element("object");b.setAttribute("id","flashPlayer-cart-"+c.itemNumber);
b.setAttribute("width","115");b.setAttribute("height","38");b.setAttribute("codebase","http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0");b.setAttribute("classid","clsid:D27CDB6E-AE6D-11cf-96B8-444553540000");var f=new Element("param",{name:"movie",value:a});var d=new Element("param",{name:"wmode",value:"transparent"});
var g=new Element("embed");g.setAttribute("width","115");g.setAttribute("height","38");g.setAttribute("name",e);g.setAttribute("wmode","transparent");g.setAttribute("swliveconnect","true");g.setAttribute("type","application/x-shockwave-flash");g.setAttribute("pluginspage","http://www.macromedia.com/go/getflashplayer");
g.setAttribute("src",a);b.appendChild(f);b.appendChild(d);if(navigator.userAgent.indexOf("MSIE")!=-1){return g;}b.appendChild(g);return b;},createCartRow:function(i){var b=new Element("a",{href:i.url});var e=document.createTextNode(i.productTypeSingle+" #"+i.productNumber);b.appendChild(e);var f=new Element("td");
f.className="info_item";f.appendChild(b);f.appendChild(this.createFlashPlayer(i));var k=new Element("td");k.className="price_remove";var h=new Element("div");h.className="remove";var g=new Element("a",{href:"/cart-remove-"+i.itemNumber+".html"});g.onclick=function(){cart.removeFromCart(i.itemNumber);
return false;};var a=new Element("img",{src:"/images/close.jpg",alt:""});g.appendChild(a);h.appendChild(g);k.appendChild(h);var c=new Element("tr",{id:i.itemNumber+"-r"});c.appendChild(f);var j=new Element("span");j.innerHTML=i.price+" "+locales["cart_credits"];var d=new Element("p");d.appendChild(j);
k.appendChild(d);c.appendChild(k);return c;},clearCartList:function(){var a=$("cart_list");if(a!=null){a.remove();}var b=$("total_cart");if(b!=null){b.remove();}$("cartBlock").appendChild(this.createCartMessage());var c=$("download_button");c.onclick="";c.setAttribute("href","#");},appendAddToCartButton:function(d){var e=$(d.itemNumber);
if(e==null){return;}e.className="button_td";e.innerHTML="";var a=new Element("span");a.onclick=function(){cart.addToCart(d.itemNumber);return false;};a.className="button";var b=new Element("span");b.className="button_left";var c=new Element("span");c.className="button_right";a.appendChild(b);b.appendChild(c);
c.appendChild(document.createTextNode(locales["add_to_cart"]));$(d.itemNumber).appendChild(a);},empty:function(){if(this.itemsCount==0){return;}var a=this;this.loader.show();new Ajax.Request("/cart_empty.jhtml",{method:"post",onComplete:function(d){a.itemsCount=0;a.loader.container.style.display="none";
a.clearCartList();var b=d.responseText.evalJSON();b.each(function(f){var e=$(f.itemNumber);if(e!=null){a.appendAddToCartButton(f);}});var c=$(a.not_enough_credits_id);if(c!=null){c.remove();}calculateHeight();}.bindAsEventListener(this)});}};
