/**
 * ideashop.js
 */
var excludeList=new Array('path','pager','DataGridRPP*','cur_*','status_*','regions*','brandId','category','mb','cpu','ram','q_ram','hda','gpu','kb','mou','dvdw','cdw','mon','sc','spk','cs','fdd','mod','prnt','tvc','os','other','opt1','opt2','opt3','extra3','SearchBrands','catSelectBox*','tokenType','variant_*');function IsDropDownExcluded(dropDownId){if(dropDownId==null||dropDownId==''){return true;}
for(var i=0;i<excludeList.length;i++){exclude=excludeList[i];if(dropDownId==exclude){return true;}
if(exclude.charAt(exclude.length-1)=='*'){excLikeStr=exclude.substring(0,exclude.length-1);if(dropDownId.search(excLikeStr)>=0){return true;}}}
return false;}
function ChangeDropDownStyle(elementId){if(!IsDropDownExcluded(elementId)){jQuery('#'+elementId).select_skin();}else{}}
function ClosePageOver(){var ie=(document.all)?1:0;if(ie){document.getElementById("PageOver").style.filter="alpha(opacity=0)";document.getElementById("PageOver").style.display="none";}else{document.getElementById("PageOver").style.opacity=0;}
document.getElementById("PageOver").style.zIndex=-5;}
function ClosePageOverEffect(){var ie=(document.all)?1:0;document.getElementById("PageOver").style.zIndex=1008;var eff=new Effect.Opacity('PageOver',{to:0.0,duration:0.3,transition:Effect.Transitions.linear,afterFinish:function(){document.getElementById("PageOver").style.zIndex=-5;document.getElementById("PageOver").style.visibility="visible";if(ie){document.getElementById("PageOver").style.display="none";}
document.getElementById("PageOver").style.height=getPageSize()[1]+"px";document.getElementById("PageOver").style.width="100%";dropdowns=document.getElementsByTagName("select");for(var i=0;i<dropdowns.length;i++){elem=dropdowns[i];if(IsDropDownExcluded(elem.getAttribute('id'))){Element.extend(elem);elem.show();}}}});if(ie){setTimeout("function() { "+"document.getElementById(\"PageOver\").style.display = \"none\";"+"document.getElementById(\"PageOver\").style.zIndex = -5;"+"document.getElementById(\"PageOver\").style.visibility = \"visible\";"+"}",300);}}
function OpenDialog(el){var ie=(document.all)?1:0;dropdowns=document.getElementsByTagName("select");for(var i=0;i<dropdowns.length;i++){elem=dropdowns[i];if(IsDropDownExcluded(elem.getAttribute('id'))){Element.extend(elem);elem.hide();}}
document.getElementById("PageOver").style.opacity=0;if(ie){document.getElementById("PageOver").style.filter="alpha(opacity=0)";document.getElementById("PageOver").style.display="block";}
document.getElementById("PageOver").style.visibility="visible";document.getElementById("PageOver").style.height=getPageSize()[1]+"px";document.getElementById("PageOver").style.width="100%";document.getElementById("PageOver").style.zIndex=1008;var eff=new Effect.Opacity('PageOver',{to:0.8,duration:0.3,transition:Effect.Transitions.linear,afterFinish:function(obj){document.getElementById("PageOver").style.zIndex=1008;var elem=document.getElementById(el);Element.extend(elem);var hg=getWindowHeight();var wd=getWindowWidth();elem.style.position="absolute";elem.style.zIndex=1009;elem.style.display="block";scrpos=getScrollXY();elem.style.left=String((wd/2)-(parseInt(elem.getWidth())/2)+scrpos[0])+"px";elem.style.top=String((hg/2)-(parseInt(elem.getHeight())/2)+scrpos[1])+"px";elem.style.visibility="visible";opendropdowns=$(el).getElementsByTagName("select");for(var i=0;i<opendropdowns.length;i++){dropDown=opendropdowns[i];ChangeDropDownStyle(dropDown.getAttribute('id'));}
if(elem.tagName!='table'||!ie){jQuery('#'+el).find('#closeButton').remove();var img=jQuery("<img id='closeButton' onclick='CloseDialog(\""+el+"\")' style='display: inline; position: absolute; right: -11px; top: -11px; z-index: 80; cursor: pointer;' src='images/formdialog/closebox.png'/>");jQuery('#'+el).append(img);}}});}
function CloseDialog(el){var elem=document.getElementById(el);elem.style.display="none";elem.style.visibility="hidden";elem.style.zIndex=-2;ClosePageOverEffect();if(document.body.style.overflow=='hidden'){document.body.style.overflow='scroll';}}
function getWindowHeight(){var windowHeight=0;if(typeof(window.innerHeight)=='number'){windowHeight=window.innerHeight;}else{if(document.documentElement&&document.documentElement.clientHeight){windowHeight=document.documentElement.clientHeight;}else{if(document.body&&document.body.clientHeight){windowHeight=document.body.clientHeight;}}}
return windowHeight;}
function getWindowWidth(){var windowWidth=0;if(typeof(window.innerWidth)=='number'){windowWidth=window.innerWidth;}else{if(document.documentElement&&document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{if(document.body&&document.body.clientWidth){windowWidth=document.body.clientWidth;}}}
return windowWidth;}
function getScrollXY(){var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX=window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}
return[scrOfX,scrOfY];}
function ShowMenu(el,target){Element.extend(el);if(el.up().style.position!="absolute"){pos=Position.cumulativeOffset(el);tx=(pos[0]+el.getWidth()-0)+"px";ty=pos[1]+"px";}else{tx=(parseInt(el.up().style.width)-2)+'px';hh=0;hx=0;while(el.previous(".MenuItem",hx)!=undefined){hh+=20
hx+=1;}
ty=hh+"px";}
$(target).style.left=tx;$(target).style.top=ty;$(target).show();}
function ShowDTMenu(target){var myArr=target.split("_");re=/\d+/g
myArr.each(function(s){if(s.match(re)){no=s.match(re);}});str="";for(var i=0;i<myArr.length-1;i++){str=str+myArr[i]+"_";}
img="img_"+str.substr(0,str.lastIndexOf('_'))+"_"+no
if($(target).visible()){if(src.indexOf("down")){src=src.replace("down","left");}
$(img).src=src
$(target).hide();}else if(!$(target).visible()){$(target).show();src=$(img).src;if(src.indexOf("left")){src=src.replace("left","down");}
$(img).src=src;}}
function ShowMenu2(target){$(target).show();}
function HideMenu(target){$(target).hide();}
function ShowTooltip(event,source){ttSource=$(source);if($("IdeaToolTip")!=null&&$("IdeaToolTip").visible){tt=$("IdeaToolTip");css=tt.classNames();for(var i=0;i<css.length;i++)
tt.removeClassName(css[i]);}else{tt=document.createElement("div");Element.extend(tt);tt.id="IdeaToolTip";tt.hide();document.body.appendChild(tt);Position.absolutize(tt);}
tt.addClassName(ttSource.className);tt.update(ttSource.innerHTML);tt.setStyle({'width':ttSource.style.width,'height':ttSource.style.height,'display':'block','z-index':1050});tt.style.left=(Event.pointerX(event)+15)+"px";tt.style.top=(Event.pointerY(event))+"px";tt.makePositioned();tt.show();}
function ShowTooltipPositioned(event,source,leftOffset,topOffset){ttSource=$(source);if($("IdeaToolTip")!=null&&$("IdeaToolTip").visible){tt=$("IdeaToolTip");css=tt.classNames();for(var i=0;i<css.length;i++)
tt.removeClassName(css[i]);}else{tt=document.createElement("div");Element.extend(tt);tt.id="IdeaToolTip";tt.hide();document.body.appendChild(tt);Position.absolutize(tt);}
tt.addClassName(ttSource.className);tt.update(ttSource.innerHTML);tt.setStyle({'width':ttSource.style.width,'height':ttSource.style.height,'display':'block','z-index':1050});tt.style.left=(Event.pointerX(event)+leftOffset)+"px";tt.style.top=(Event.pointerY(event)+topOffset)+"px";tt.makePositioned();tt.show();}
function HideTooltip(){$('IdeaToolTip').hide();}
function getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=document.body.scrollWidth;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){windowWidth=self.innerWidth;windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=windowWidth;}else{pageWidth=xScroll;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;}
function addSearchLabelToUrl(type){var formId='';var slabel='';if(type=='1'){formId='QuickSearch';slabel=document.getElementById('QuickSearchLabel').value;}else if(type=='2'){var slabel=document.getElementById('QuickSearchBlockLabel').value;formId='QuickSearchBlock';}
if(slabel.indexOf("&")==0){slabel=slabel.substring(1,slabel.length);}
var url=document.getElementById(formId).action;url+='&q='+slabel.replace('+','%2B');window.location=url;return false;}
var selectElements=document.getElementsByTagName('select');jQuery(document).ready(function(){var selectId='';for(var i=0;i<selectElements.length;i++){selectId=selectElements[i].getAttribute('id');ChangeDropDownStyle(selectId);}});

/**
 * ideacart.js
 */
function IdeaCart(){this.productCount=0;this.products=new Hash;if($("hiddenCart")){this.cartTemplate=new Template("")}else{this.cartTemplate=new Template('<table width=100% border=0 cellspacing=0 cellpadding=0><tr><td height=16><img src="images/arrowblack.gif" width=7 height=8><b> #{product}</b></td><td rowspan=2 align=right valign=top><a href="JavaScript:ideacart1.RemoveFromCart(\'#{pid}\')"><img src="images/xx.gif" border=0></a></td></tr><tr><td height=17><b>#{amount}</b> #{stockTypeLabel} <b style="color:#FF0000; padding-left:10px;">#{price} #{curr}</b></td></tr></table>')}this.lastUpdate="";this.lastId=new Hash}if(noDrag==undefined)var noDrag=0;var pdrags=new Hash;var DDS=new Array;var totalAmount=0;IdeaCart.prototype.AddToCartBasic=function(a,b,c,d,e,f,g,h,i,j,k){i=unescape(i);if(DDS.length>0&&this.lastId.toArray().length==0&&this.productCount>0){this.products.each(function(a){if(ideacart1.lastId[a.value.pid]==undefined)ideacart1.lastId[a.value.pid]=0;if(a.value.ext>parseInt(ideacart1.lastId[a.value.pid]))ideacart1.lastId[a.value.pid]=a.value.ext})}if(parseFloat(c)<.01){alert("Ürün fiyatı hatalı olduğu için sepete atılamaz. Lütfen sistem yöneticisiyle irtibata geçiniz");return false}temp2="";if(DDS.length>0){var l=new Array;for(var m=0;m<DDS.length;m++){var n=DDS[m].id;optionLabel=$(n).value;if(optionLabel!="")l.push(optionLabel)}temp2=l.join("/")}if(temp2!=""){b=b+" "+temp2}b=unescape(b);b=unescape(escape(b).replace(/%C2%A0/g,"%20"));b=unescape(escape(b).replace(/%A0/g,"%20"));b=b.replace(/[^0-9a-zA-ZğüşıiöçĞÜŞIİÖÇ\n\t\s\.\*\+&;#,=\[\]{}\(\)\/\\%\$\^\?'"@:<>\-_!€~]/gi,"");if(b.indexOf("}")>0){b=b.replace(/}/gi,"&#125;")}if(b.indexOf("{")>0){b=b.replace(/{/gi,"&#123;")}pid2=a;if(this.lastId[a]&&this.products["pr_"+a+"_"+this.lastId[a]]){exist=false;index=0;for(var m=1;m<=this.lastId[a];m++){if(!this.products["pr_"+a+"_"+m])continue;currentel=this.products["pr_"+a+"_"+m]["product"].toString();if(b.toLowerCase()==currentel.toLowerCase()){exist=true;index=m}}if(exist){ext=index}else{this.lastId[a]++;ext=this.lastId[a]}}else{ext=1;this.lastId[a]=1}a=a+"_"+ext;if($("quantity_"+pid2)!=null){if(isNaN(parseFloat($("quantity_"+pid2).value))){alert("Lütfen Stok Adedini Doğru Giriniz.");$("quantity_"+pid2).value=1;return}if(parseFloat($("realamount_"+pid2).value)<parseFloat($("quantity_"+pid2).value)){$("quantity_"+pid2).value=parseInt($("realamount_"+pid2).value)}}if($("cartItem_"+a)!=null){if(this.products["pr_"+a]["amount"]>=parseFloat($("realamount_"+pid2).value)){this.quantityWarn();return}var o=1;if($("quantity_"+pid2)!=null){o=parseFloat($("quantity_"+pid2).value);this.products["pr_"+a]["amount"]=parseFloat(this.products["pr_"+a]["amount"])+o;if(this.products["pr_"+a]["amount"]>parseFloat($("realamount_"+pid2).value)){this.products["pr_"+a]["amount"]=parseFloat($("realamount_"+pid2).value);this.quantityWarn()}else{if($("hiddenCart")){var p=parseInt($("hiddenCart").value);p=p+parseFloat($("quantity_"+pid2).value);$("hiddenCart").value=p;$("hiddenCartContainer").innerHTML="("+p+")"}}}else{this.products["pr_"+a]["amount"]=parseFloat(this.products["pr_"+a]["amount"])+1;if($("hiddenCart")){var p=parseInt($("hiddenCart").value);p=p+1;$("hiddenCart").value=p;$("hiddenCartContainer").innerHTML="("+p+")"}}pr=parseFloat(this.products["pr_"+a]["price"]);if(f!=0&&g==1||g==0){if(g==0){pr=f}else{pr=pr*(100-f)/100}}pr=pr*(100+e)/100;pr=pr.toFixed(2);total=parseFloat(pr)*parseFloat(this.products["pr_"+a]["amount"]);total=total.toFixed(2);$("cartItem_inner_"+a).innerHTML=this.cartTemplate.evaluate({product:this.products["pr_"+a]["product"].truncate(22,"..."),amount:this.products["pr_"+a]["amount"],pid:a,price:total,curr:d,tax:e,rebate:f,rebateType:g,bt:h,stockTypeLabel:i,rootProduct:k});totalAmount+=parseFloat(ideacurr1.Convert(pr*o,d,ideacurr1.DefaultCurr));totalAmount=parseFloat(totalAmount.toFixed(2))}else{if(parseFloat($("realamount_"+pid2).value)==0)return;this.productCount++;this.products["pr_"+a]=new Hash;if($("quantity_"+pid2)!=null){this.products["pr_"+a]["amount"]=parseFloat($("quantity_"+pid2).value);if(this.products["pr_"+a]["amount"]>parseFloat($("realamount_"+pid2).value)){this.products["pr_"+a]["amount"]=parseFloat($("realamount_"+pid2).value);this.quantityWarn()}if($("hiddenCart")){var p=parseInt($("hiddenCart").value);p=p+parseFloat($("quantity_"+pid2).value);$("hiddenCart").value=p;$("hiddenCartContainer").innerHTML="("+p+")"}}else{this.products["pr_"+a]["amount"]=1;if($("hiddenCart")){var p=parseInt($("hiddenCart").value);p=p+1;$("hiddenCart").value=p;$("hiddenCartContainer").innerHTML="("+p+")"}}this.products["pr_"+a]["price"]=c;this.products["pr_"+a]["product"]=b;this.products["pr_"+a]["pid"]=pid2;this.products["pr_"+a]["curr"]=d;this.products["pr_"+a]["tax"]=e;this.products["pr_"+a]["rebate"]=f;this.products["pr_"+a]["rebateType"]=g;this.products["pr_"+a]["bt"]=h;this.products["pr_"+a]["ext"]=ext;this.products["pr_"+a]["stockTypeLabel"]=i;this.products["pr_"+a]["rootProduct"]=k;var q=document.createElement("div");Element.extend(q);q.hide();q.id="cartItem_"+a;var r=document.createElement("div");Element.extend(r);r.addClassName("productOnCart");pr=c;if(f!=0&&g==1||g==0){if(g==0){pr=f}else{pr=pr*(100-f)/100}}pr=pr*(100+e)/100;pr=pr.toFixed(2);total=parseFloat(pr)*parseFloat(this.products["pr_"+a]["amount"]);total=total.toFixed(2);totalAmount+=parseFloat(ideacurr1.Convert(pr,this.products["pr_"+a]["curr"],ideacurr1.DefaultCurr))*parseFloat(this.products["pr_"+a]["amount"]);totalAmount=parseFloat(totalAmount.toFixed(2));r.innerHTML=this.cartTemplate.evaluate({product:this.products["pr_"+a]["product"].truncate(22,"..."),amount:this.products["pr_"+a]["amount"],pid:a,price:total,curr:d,stockTypeLabel:i});r.id="cartItem_inner_"+a;q.appendChild(r);if(this.productCount==1)$("CartContainer").innerHTML="";$("CartContainer").appendChild(q);Effect.Appear("cartItem_"+a,{duration:1})}if($("totalCartAmount")){$("totalCartAmount").innerHTML="<b>Toplam :</b> <b style='color:red;'>"+totalAmount+" "+ideacurr1.DefaultCurr+"</b>"}if(this.products["pr_"+a]["amount"]>=parseFloat($("realamount_"+pid2).value)){if($("addtocart_product")!=null){$("cartPic_"+pid2).src="themes/"+buttonsDir+"/nostock_product.gif"}else{$("cartPic_"+pid2).src="themes/"+buttonsDir+"/nostock.gif"}if(pdrags[pid2])pdrags[pid2].destroy()}var s=document.createElement("div");s.id="itemDiv";Element.extend(s);if($("product_min_image_"+pid2)!=null){itemDivImg=$("product_min_image_"+pid2);if($("list_type_min_img_"+pid2)!=null){imageMain=$("list_type_min_img_"+pid2)}else{imageMain=itemDivImg}}else if($("PrimaryImage")!=null){itemDivImg=$("PrimaryImage");imageMain=itemDivImg}var t;var u;if($("list_type_min_img_"+pid2)!=null){document.getElementById("list_type_min_img_"+pid2).parentNode.style.display="block";t=$("list_type_min_img_"+pid2).width;u=$("list_type_min_img_"+pid2).height;document.getElementById("list_type_min_img_"+pid2).parentNode.style.display="none"}else{t=itemDivImg.width;u=itemDivImg.height}imageSrc=imageMain.src;if(imageMain.width<30||imageMain.height<30){imageSrc="images/nopic_product.jpg";t=120;u=120}if(document.doctype!=null||document.all[0].text!=undefined){s.innerHTML='<div class="cartImageContainer" style="position:relative;"><div class="cartImageLoading" id="itemDivLoading" style="width:'+t+"px; height:"+u+'px; position:absolute;left:0px;*left:0px;top:0px;top:0px;background:url(/images/loading2.gif) no-repeat 50% 50%;z-index:4;"></div><div class="cartImageStyle"><img src="'+imageSrc+'" style="width:'+t+"px; height:"+u+'px; opacity:0.2;filter:alpha(opacity=20);" border="0" id="itemDivImg"></div></div>'}else{s.innerHTML='<div class="cartImageContainer" style="position:relative;"><div class="cartImageLoading" id="itemDivLoading" style="width:'+t+"px; height:"+u+"px; width:"+t+"px; position:absolute;left:0px;*left:-"+(t/2-5)+'px;top:0px;background:url(/images/loading2.gif) no-repeat 50% 50%;*background:url(/images/loading2.gif) no-repeat 50% 50%;z-index:4;"></div><div class="cartImageStyle"><img src="'+imageSrc+'" style="width:'+t+"px; height:"+u+'px; opacity:0.2;filter:alpha(opacity=20);" border="0" id="itemDivImg"></div></div>'}document.body.appendChild(s);s.setStyle({position:"absolute",width:t,height:u,backgroundColor:"#fff",zIndex:"2",border:"5px solid #eee"});pos=Position.cumulativeOffset(itemDivImg);s.style.left=pos[0]-6+"px";s.style.top=pos[1]-5+"px";cartpos=Position.cumulativeOffset($("CartContainer"));new Effect.Parallel([new Effect.MoveBy(s,cartpos[1]-pos[1],cartpos[0]-pos[0],{sync:true}),new Effect.Opacity(s,{sync:true,to:0,from:1,afterFinish:function(a){a.element.remove()}})],{duration:1});if(j){if(SaveCart(escape(this.products.inspect()),"type=r"))window.location="index.php?do=catalog/order"}else{SaveCart(escape(this.products.inspect()),"type=r")}if($("cartPromotion")!=null){jQuery.get("index.php?do=catalog/ajax&ref=getPromotions",function(a){if(a.length>0){$("cartPromotion").innerHTML=a;$("cartPromotion").show()}else{$("cartPromotion").innerHTML="";$("cartPromotion").hide()}})}};IdeaCart.prototype.AddToCart=function(a,b,c,d,e,f,g,h,i,j,k,l){if(!k){new Ajax.Request("index.php?do=catalog/hasOption&pid="+a,{method:"get",onSuccess:function(k){if(k.responseText=="1"){window.location="index.php?do=catalog/product&pid="+a;return false}else{ideacart1.AddToCartBasic(a,b,c,d,e,f,g,h,i,j,l)}}})}else{ideacart1.AddToCartBasic(a,b,c,d,e,f,g,h,i,j,l)}};IdeaCart.prototype.RemoveFromPage=function(a){Element.extend(a);a.remove()};IdeaCart.prototype.TruncateCart=function(a){this.productCount=0;if($("totalCartAmount"))$("totalCartAmount").innerHTML="";this.products=new Hash;this.FreeCart();SaveCart(escape(this.products.inspect()),"type=e,method=post")};IdeaCart.prototype.FreeCart=function(a){if($("hiddenCart")){$("CartContainer").innerHTML=""}else{$("CartContainer").innerHTML="<center><br/>Alışveriş sepetinizde <br/> ürün bulunmamaktadır.<br/><br/></center>"}};IdeaCart.prototype.RemoveFromCart=function(a){if(this.products["pr_"+a]==undefined)return;pid2=this.products["pr_"+a]["pid"];if(this.products["pr_"+a]){if(this.products["pr_"+a]["amount"]>1){this.products["pr_"+a]["amount"]=this.products["pr_"+a]["amount"]-1;rebate=ideacart1.products["pr_"+a]["rebate"];rebateType=ideacart1.products["pr_"+a]["rebateType"];tax=ideacart1.products["pr_"+a]["tax"];pr=parseFloat(this.products["pr_"+a]["price"]);if(rebate!=0&&rebateType==1||rebateType==0){if(rebateType==0){pr=rebate}else{pr=pr*(100-rebate)/100}}pr=pr*(100+tax)/100;pr=pr.toFixed(2);total=parseFloat(pr)*parseFloat(this.products["pr_"+a]["amount"]);total=total.toFixed(2);totalAmount-=parseFloat(ideacurr1.Convert(pr,ideacart1.products["pr_"+a]["curr"],ideacurr1.DefaultCurr));totalAmount=parseFloat(totalAmount.toFixed(2));curr=this.products["pr_"+a]["curr"];$("cartItem_inner_"+a).innerHTML=this.cartTemplate.evaluate({product:this.products["pr_"+a]["product"].truncate(22,"..."),amount:this.products["pr_"+a]["amount"],pid:a,price:total,curr:this.products["pr_"+a]["curr"],stockTypeLabel:this.products["pr_"+a]["stockTypeLabel"]})}else{curr=this.products["pr_"+a]["curr"];rebate=ideacart1.products["pr_"+a]["rebate"];rebateType=ideacart1.products["pr_"+a]["rebateType"];tax=ideacart1.products["pr_"+a]["tax"];pr=parseFloat(this.products["pr_"+a]["price"]);if(rebate!=0&&rebateType==1||rebateType==0){if(rebateType==0){pr=rebate}else{pr=pr*(100-rebate)/100}}pr=pr*(100+tax)/100;total=parseFloat(pr)*parseFloat(this.products["pr_"+a]["amount"]);total=total.toFixed(2);totalAmount-=parseFloat(ideacurr1.Convert(pr,this.products["pr_"+a]["curr"],ideacurr1.DefaultCurr));totalAmount=parseFloat(totalAmount.toFixed(2));this.products.remove("pr_"+a);this.productCount--;new Effect.Fade("cartItem_"+a,{duration:1,afterFinish:function(a){ideacart1.RemoveFromPage(a.element);if(ideacart1.productCount<1){ideacart1.productCount=0;ideacart1.FreeCart()}}})}if($("cartPic_"+pid2)!=undefined){if($("addtocart_product")!=null){$("cartPic_"+pid2).src="themes/"+buttonsDir+"/addtocart_product.gif"}else{$("cartPic_"+pid2).src="themes/"+buttonsDir+"/addtocart.gif"}if(!noDrag)pdrags[a]=new Draggable("Item_"+pid2,{revert:true,ghosting:false,zindex:1003})}if(this.productCount<1){totalAmount=0}if($("totalCartAmount")){$("totalCartAmount").innerHTML=totalAmount>0?"<b>Toplam :</b> <b style='color:red;'>"+totalAmount+" "+ideacurr1.DefaultCurr+"</b>":"";SaveCart(escape(this.products.inspect()),"type=r,method=post")}}if($("cartPromotion")!=null){jQuery.get("index.php?do=catalog/ajax&ref=getPromotions",function(a){if(a.length>0){$("cartPromotion").innerHTML=a;$("cartPromotion").show()}else{$("cartPromotion").innerHTML="";$("cartPromotion").hide()}})}};IdeaCart.prototype.CompleteRemoveFromCart=function(a){this.products.remove("pr_"+a);this.productCount--;ideacart1.RemoveFromPage($("cartItem_"+a));ideacart1.lastId=new Hash;this.products.each(function(a){ideacart1.lastId[a.value.pid]=a.value.ext});if(ideacart1.productCount<1){ideacart1.productCount=0;ideacart1.FreeCart()}};IdeaCart.prototype.ReloadCart=function(){this.productCount=0;$("CartContainer").innerHTML="";var a=0;var b="";totalAmount=0;this.products.each(function(c){pid=c.key.substring(3);var d=document.createElement("div");Element.extend(d);d.id="cartItem_"+pid;var e=document.createElement("div");Element.extend(e);e.addClassName("productOnCart");pr=parseFloat(ideacart1.products["pr_"+pid]["price"]);rebate=ideacart1.products["pr_"+pid]["rebate"];rebateType=ideacart1.products["pr_"+pid]["rebateType"];tax=ideacart1.products["pr_"+pid]["tax"];if(rebate!=0){if(rebateType==0){pr=rebate}else{pr=pr*(100-rebate)/100}}pr=pr*(100+tax)/100;total=parseFloat(pr)*parseFloat(ideacart1.products["pr_"+pid]["amount"]);if($("hiddenCart")){a=a+parseFloat(ideacart1.products["pr_"+pid]["amount"]);$("hiddenCart").value=a;$("hiddenCartContainer").innerHTML="("+a+")"}total=total.toFixed(2);b=ideacart1.products["pr_"+pid]["curr"];totalAmount+=parseFloat(ideacurr1.Convert(total,b,ideacurr1.DefaultCurr));e.innerHTML=ideacart1.cartTemplate.evaluate({product:ideacart1.products["pr_"+pid]["product"].truncate(22,"..."),amount:ideacart1.products["pr_"+pid]["amount"],pid:pid,price:total,curr:ideacart1.products["pr_"+pid]["curr"],stockTypeLabel:ideacart1.products["pr_"+pid]["stockTypeLabel"]});e.id="cartItem_inner_"+pid;d.appendChild(e);ideacart1.productCount++;$("CartContainer").appendChild(d)});totalAmount=parseFloat(totalAmount.toFixed(2));if(ideacart1.productCount==0){if($("hiddenCart")){$("CartContainer").update("");totalAmount=0}else{$("CartContainer").update("<center><br>Alışveriş sepetinizde <br> ürün bulunmamaktadır.<br><br></center>");if($("totalCartAmount")){$("totalCartAmount").update=""}totalAmount=0}}else{if($("totalCartAmount")){$("totalCartAmount").innerHTML="<b>Toplam :</b> <b style='color:red;'>"+totalAmount+" "+ideacurr1.DefaultCurr+"</b>"}}};IdeaCart.prototype.quantityWarn=function(){if($("quantityWarn")!=null){quantityWarning=quantityWarning.replace("(arg0)",parseFloat($("realamount_"+pid2).value));$("quantityWarn").update(quantityWarning);Effect.Appear("quantityWarn",{queue:{position:"front",scope:"myscope",limit:2},duration:1});Effect.Fade("quantityWarn",{queue:{position:"end",scope:"myscope",limit:2},duration:1})}else{quantityWarning=quantityWarning.replace("(arg0)",parseFloat($("realamount_"+pid2).value));alert(quantityWarning)}}

/**
 * ideacurr.js
 */
function IdeaCurr(defaultCurr){this.Currencies=new Array();this.Currencies['YTL']=3.0000;this.Currencies['TL']=2.0000;this.DefaultCurr=defaultCurr;}
IdeaCurr.prototype.Load=function(currencies){ideacurr1.Currencies=new Array();var currencies=currencies.split('-');var currValues=new Array();for(var i=0;i<currencies.length;i++){currValues=currencies[i].split('_');ideacurr1.Currencies[currValues[0]]=parseFloat(currValues[1]);}}
IdeaCurr.prototype.Convert=function(price,from,to){if(from=='YTL'){from='TL';}
if(to=='YTL'){to='TL';}
var price1=this.Currencies[from];var price2=this.Currencies[to];var ratio=price1/price2;var result=price*ratio;return result.toFixed(4);}

/**
 * ideacurr.js
 */
function IdeaCurr(defaultCurr){this.Currencies=new Array();this.Currencies['YTL']=3.0000;this.Currencies['TL']=2.0000;this.DefaultCurr=defaultCurr;}
IdeaCurr.prototype.Load=function(currencies){ideacurr1.Currencies=new Array();var currencies=currencies.split('-');var currValues=new Array();for(var i=0;i<currencies.length;i++){currValues=currencies[i].split('_');ideacurr1.Currencies[currValues[0]]=parseFloat(currValues[1]);}}
IdeaCurr.prototype.Convert=function(price,from,to){if(from=='YTL'){from='TL';}
if(to=='YTL'){to='TL';}
var price1=this.Currencies[from];var price2=this.Currencies[to];var ratio=price1/price2;var result=price*ratio;return result.toFixed(4);}
/**
 * ideacompare.js
 */
function IdeaCompare(maxCompareCount){this.MAX_COMPARE_PRODUCT_COUNT=maxCompareCount;this.infoGroupId=0;this.products=new Array();this.load();}
IdeaCompare.prototype.addToCompare=function(productElement){if(this.products.length==this.MAX_COMPARE_PRODUCT_COUNT){return false;}
pid=parseInt(productElement.getAttribute('pid'));groupId=parseInt(productElement.getAttribute('groupid'));if(isNaN(pid)||isNaN(groupId)||pid<=0||groupId<=0){return false;}
if(this.infoGroupId!=0&&groupId!=this.infoGroupId){return false;}
this.infoGroupId=groupId;for(var i=0;i<this.products.length;i++){if(this.products[i]==pid){return false;}}
this.products[this.products.length]=pid;this.updateCookie();this.updateComparePanel();}
IdeaCompare.prototype.hasProduct=function(productId){for(var i=0;i<this.products.length;i++){if(this.products[i]==productId){return true;}}
return false;}
IdeaCompare.prototype.updateComparePanel=function(){if(this.products.length!=0){var inputs=document.getElementsByTagName('input');var elementId='';for(var i=0;i<inputs.length;i++){pid=parseInt(inputs[i].getAttribute('pid'));groupId=parseInt(inputs[i].getAttribute('groupid'));if(isNaN(pid)||isNaN(groupId)||pid<=0||groupId<=0){continue;}
elementId=inputs[i].getAttribute('id');if(groupId!=this.infoGroupId){$(elementId).style.visibility='hidden';$(this.nextElementId($(elementId))).style.visibility='hidden';}
$(elementId).checked=this.hasProduct(pid);}}else{var inputs=document.getElementsByTagName('input');var elementId='';for(var i=0;i<inputs.length;i++){pid=parseInt(inputs[i].getAttribute('pid'));groupId=parseInt(inputs[i].getAttribute('groupid'));if(isNaN(pid)||isNaN(groupId)||pid<=0||groupId<=0){continue;}
elementId=inputs[i].getAttribute('id');if(groupId!=this.infoGroupId){$(elementId).style.visibility='visible';var nextId=this.nextElementId($(elementId));if(nextId){$(nextId).style.visibility='visible';}}
$(elementId).checked=this.hasProduct(pid);}}}
IdeaCompare.prototype.nextElementId=function(element){if(document.all){var parent=element.parentNode;var children=parent.childNodes;for(var i=0;i<children.length;i++){if(children[i]==element){if(i<children.length-2){return children[i+2].getAttribute('id');}
return false;}}
return false;}else{if(element.nextSibling==null){return false;}
return element.nextSibling.nextSibling.getAttribute('id');}}
IdeaCompare.prototype.removeFromCompare=function(productElement){var pid=parseInt(productElement.getAttribute('pid'));if(isNaN(pid)||pid<=0){return false;}
var index=0;while(index<this.products.length&&this.products[index]!=pid){index++;}
if(index<this.products.length){if(this.products.length>1){for(var i=index;i<this.products.length-1;i++){this.products[i]=this.products[i+1];}
this.products.length=this.products.length-1;}else{this.products=new Array();this.infoGroupId=0;}}
this.updateCookie();this.updateComparePanel();}
IdeaCompare.prototype.load=function(){this.products=this.getCookie('IdeaCompareProducts').split(',');this.infoGroupId=parseInt(this.getCookie('IdeaCompareGroupId').split(','));if(this.products.length>this.MAX_COMPARE_PRODUCT_COUNT||isNaN(this.infoGroupId)||this.infoGroupId<=0){this.products=new Array();this.infoGroupId=0;}}
IdeaCompare.prototype.updateCookie=function(){this.setCookie('IdeaCompareProducts',this.products.join(','));this.setCookie('IdeaCompareGroupId',this.infoGroupId);}
IdeaCompare.prototype.getCookie=function(name){if(document.cookie.length>0){c_start=document.cookie.indexOf(name+"=");if(c_start!=-1){c_start=c_start+name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}
return"";}
IdeaCompare.prototype.setCookie=function(name,value){var date=new Date();date.setTime(date.getTime()+(365*24*60*60*1000));document.cookie=name+'='+value+'; expires='+date.toGMTString()+'; path=/';}
/**
 * tabslide.js
 */
var midBlockIds=new Array();function slideProducts(midBlock,jsOffset){var slideLeftImage="slideLeftImage";var slideRightImage="slideRightImage";var slideLeftLink="slideLeftLink";var slideRightLink="slideRightLink";var contentDiv="slideContent";jQuery('#slideContent').html("");jQuery('#slideLoading').show();for(var i=0;i<midBlockIds.length;i++){jQuery("#midBlock"+midBlockIds[i]).attr("class","");}
jQuery("#midBlock"+midBlock).attr("class","ui-tabs-selected");if(jsOffset<0){jsOffset=0;}
jQuery.ajax({type:"POST",url:"index.php?do=catalog/showTabMidBlock",data:"midBlock="+midBlock+"&offset="+jsOffset,dataType:"json",async:false,success:function(json){var count=json.count;var template=json.template;var limit=json.limit;jQuery('#slideLoading').hide();jQuery("#"+contentDiv).html(template);if(jsOffset+limit<count&&jsOffset==0){document.getElementById(slideLeftImage).setAttribute("src","images/tabs/pagerleft.gif");document.getElementById(slideRightImage).setAttribute("src","images/tabs/pagerrighthover.gif");document.getElementById(slideLeftLink).onclick=function(){};document.getElementById(slideRightLink).onclick=function(){slideProducts(midBlock,jsOffset+limit)};}else if(jsOffset+limit<count&&jsOffset>0){document.getElementById(slideLeftImage).setAttribute("src","images/tabs/pagerlefthover.gif");document.getElementById(slideRightImage).setAttribute("src","images/tabs/pagerrighthover.gif");document.getElementById(slideLeftLink).onclick=function(){slideProducts(midBlock,jsOffset-limit)};document.getElementById(slideRightLink).onclick=function(){slideProducts(midBlock,jsOffset+limit)};}else if(count<=limit){document.getElementById(slideLeftImage).setAttribute("src","images/tabs/pagerleft.gif");document.getElementById(slideRightImage).setAttribute("src","images/tabs/pagerright.gif");document.getElementById(slideLeftLink).onclick=function(){};document.getElementById(slideRightLink).onclick=function(){};}else if(jsOffset+limit>=count){document.getElementById(slideLeftImage).setAttribute("src","images/tabs/pagerlefthover.gif");document.getElementById(slideRightImage).setAttribute("src","images/tabs/pagerright.gif");document.getElementById(slideLeftLink).onclick=function(){slideProducts(midBlock,jsOffset-limit)};document.getElementById(slideRightLink).onclick=function(){};}}});}
/**
 * select_skin.js
 */
(function($){$.fn.select_skin=function(w){return $(this).each(function(i){s=$(this);oldParent=s.parent();if(!s.attr('multiple')&&!oldParent.hasClass('cmf-skinned-select')){s.wrap('<div class="cmf-skinned-select"></div>');c=s.parent();c.children().before('<div class="cmf-skinned-text"> </div>').each(function(){if(this.selectedIndex>=0)$(this).prev().text(this.options[this.selectedIndex].innerHTML)});c.width(s.outerWidth()-2);c.height(s.outerHeight()-1);c.css('background-color',s.css('background-color'));c.css('color',s.css('color'));c.css('font-size',s.css('font-size'));c.css('font-family',s.css('font-family'));c.css('font-style',s.css('font-style'));c.css('position','relative');s.css({'opacity':0,'position':'relative','z-index':100});var t=c.children().prev();t.height(c.outerHeight()-s.css('padding-top').replace(/px,*\)*/g,"")-s.css('padding-bottom').replace(/px,*\)*/g,"")-t.css('padding-top').replace(/px,*\)*/g,"")-t.css('padding-bottom').replace(/px,*\)*/g,"")+2);t.css({'opacity':100,'overflow':'hidden','position':'absolute','text-indent':'0px','z-index':1,'left':0});c.children().click(function(){t.text((this.options!=undefined&&this.options.length>0&&this.selectedIndex>=0?this.options[this.selectedIndex].innerHTML:''));});c.children().change(function(){t.text((this.options!=undefined&&this.options.length>0&&this.selectedIndex>=0?this.options[this.selectedIndex].innerHTML:''));});}});}
$.fn.select_unskin=function(w){return $(this).each(function(i){s=$(this);if(!s.attr('multiple')&&s.parent().hasClass('cmf-skinned-select')){s.siblings('.cmf-skinned-text').remove();s.css({'opacity':100,'z-index':0}).unwrap();}});}}(jQuery));

 
 /**
 * Lightbox ürün sayfasını açar
 */
 function OpenProduct(id){jQuery('#OpenProduct_Body').load('index.php?do=catalog/product.ajax&pid='+id);OpenDialog('OpenProduct');}
 
 /**
  * Promosyon Sistemi.
  */
 function OpenPromotionProducts(id){jQuery('#OpenPromotionProducts_Body').load('index.php?do=catalog/promotion.ajax&id='+id);OpenDialog('OpenPromotionProducts');}
 
 /**
  * Varyant Sistemi
  */
 
 function showOptions(id){jQuery(".optionsProducts_"+id).stop(true,true).animate({ opacity : "toggle" }, "slow");}
 
  /**
  *   Lightbox Taksit Seçeneklerini açar.
  */
 function OpenPaymentOptions(id){jQuery('#OpenPaymentOptions_Body').load('index.php?do=catalog/ajax&ref=getPaymentOptions&productId='+id);OpenDialog('OpenPaymentOptions');}
 
  /**
  *  Lightbox Ürün yorumlarını açar.
  */
 
 function OpenCommentsAdmin(id){jQuery('#OpenCommentsAdmin_Body').load('index.php?do=catalog/ajax&ref=getComments&productId='+id+'&l=1');OpenDialog('OpenCommentsAdmin');}
 
 /**
  * facebook login izin verme sayfasını açar.
  */
 function fblogin(){url = document.getElementById('fburl').value;  window.open(url, "newRegister", "width=600,height=400,top=200,left=200");}
