/**
 * 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*');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(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(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(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();}
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(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(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(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
 */
if(noDrag==undefined)var noDrag=0;var pdrags=new Hash();var DDS=new Array();var totalAmount=0;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();}
IdeaCart.prototype.AddToCartBasic=function(pid,label,price,curr,tax,rebate,rebateType,bt,stockTypeLabel,quickorder){label=unescape(label);label=label.replace(/[^0-9a-zA-ZğüşıiöçĞÜŞIİÖÇ\n\t\s\.\*\+&#;,=\[\]{}\(\)\/\\%\$\^\?'"@:<>\-_!€~]/gi,'');if(label.indexOf("}")>0){label=label.replace(/}/gi,"}");}
if(label.indexOf("{")>0){label=label.replace(/{/gi,"{");}
stockTypeLabel=unescape(stockTypeLabel);if(DDS.length>0&&this.lastId.toArray().length==0&&this.productCount>0){this.products.each(function(pair){if(ideacart1.lastId[pair.value.pid]==undefined)ideacart1.lastId[pair.value.pid]=0;if(pair.value.ext>parseInt(ideacart1.lastId[pair.value.pid]))ideacart1.lastId[pair.value.pid]=pair.value.ext;});}
temp2="";if(DDS.length>0){var temp=new Array()
for(i=0;i<DDS.length;i++){var optionSelect=DDS[i].id
optionLabel=$(optionSelect).value
if(optionLabel!="")temp.push(optionLabel);}
temp2=temp.join("/");}
if(temp2!=""){label=label+" "+temp2;}
pid2=pid;if(this.lastId[pid]&&this.products["pr_"+pid+"_"+this.lastId[pid]]){exist=false;index=0;for(i=1;i<=this.lastId[pid];i++){if(!this.products["pr_"+pid+"_"+i])continue;currentel=this.products["pr_"+pid+"_"+i]["product"].toString();if(label.toLowerCase()==currentel.toLowerCase()){exist=true;index=i;}}
if(exist){ext=index;}else{this.lastId[pid]++;ext=this.lastId[pid];}}else{ext=1;this.lastId[pid]=1;}
pid=pid+"_"+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_"+pid)!=null){if(this.products["pr_"+pid]["amount"]>=parseFloat($('realamount_'+pid2).value)){this.quantityWarn();return;}
var addedAmount=1;if($('quantity_'+pid2)!=null){addedAmount=parseFloat($('quantity_'+pid2).value);this.products["pr_"+pid]["amount"]=parseFloat(this.products["pr_"+pid]["amount"])+addedAmount;if(this.products["pr_"+pid]["amount"]>=parseFloat($('realamount_'+pid2).value)){this.products["pr_"+pid]["amount"]=parseFloat($('realamount_'+pid2).value);this.quantityWarn();}if($('hiddenCart')){var hiddenCart=parseFloat($('hiddenCart').value);hiddenCart=hiddenCart+parseFloat($('quantity_'+pid2).value);$('hiddenCart').value=hiddenCart;$('hiddenCartContainer').innerHTML='('+hiddenCart+')';}}else{this.products["pr_"+pid]["amount"]=parseFloat(this.products["pr_"+pid]["amount"])+1;if($('hiddenCart')){var hiddenCart=parseFloat($('hiddenCart').value);hiddenCart=hiddenCart+1;$('hiddenCart').value=hiddenCart;$('hiddenCartContainer').innerHTML='('+hiddenCart+')';}}
pr=parseFloat(this.products["pr_"+pid]["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_"+pid]["amount"]);total=total.toFixed(2);$("cartItem_inner_"+pid).innerHTML=this.cartTemplate.evaluate({'product':this.products["pr_"+pid]["product"].truncate(22,"..."),'amount':this.products["pr_"+pid]["amount"],'pid':pid,'price':total,'curr':curr,'tax':tax,'rebate':rebate,'rebateType':rebateType,'bt':bt,'stockTypeLabel':stockTypeLabel});totalAmount+=parseFloat(ideacurr1.Convert(pr*addedAmount,curr,ideacurr1.DefaultCurr));totalAmount=parseFloat(totalAmount.toFixed(2));}else{if(parseFloat($('realamount_'+pid2).value)==0)return;this.productCount++;this.products["pr_"+pid]=new Hash();if($('quantity_'+pid2)!=null){this.products["pr_"+pid]["amount"]=parseFloat($('quantity_'+pid2).value);if(this.products["pr_"+pid]["amount"]>=parseFloat($('realamount_'+pid2).value)){this.products["pr_"+pid]["amount"]=parseFloat($('realamount_'+pid2).value);this.quantityWarn();}
if($('hiddenCart')){var hiddenCart=parseFloat($('hiddenCart').value);hiddenCart=hiddenCart+parseFloat($('quantity_'+pid2).value);$('hiddenCart').value=hiddenCart;$('hiddenCartContainer').innerHTML='('+hiddenCart+')';}}else{this.products["pr_"+pid]["amount"]=1;if($('hiddenCart')){var hiddenCart=parseFloat($('hiddenCart').value);hiddenCart=hiddenCart+1;$('hiddenCart').value=hiddenCart;$('hiddenCartContainer').innerHTML='('+hiddenCart+')';}}
this.products["pr_"+pid]["price"]=price;this.products["pr_"+pid]["product"]=label;this.products["pr_"+pid]["pid"]=pid2;this.products["pr_"+pid]["curr"]=curr;this.products["pr_"+pid]["tax"]=tax;this.products["pr_"+pid]["rebate"]=rebate;this.products["pr_"+pid]["rebateType"]=rebateType;this.products["pr_"+pid]["bt"]=bt;this.products["pr_"+pid]["ext"]=ext;this.products["pr_"+pid]["stockTypeLabel"]=stockTypeLabel;var parent_div=document.createElement('div');Element.extend(parent_div);parent_div.hide();parent_div.id='cartItem_'+pid;var child_div=document.createElement('div');Element.extend(child_div);child_div.addClassName("productOnCart");pr=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_"+pid]["amount"]);total=total.toFixed(2);totalAmount+=parseFloat(ideacurr1.Convert(pr,this.products['pr_'+pid]['curr'],ideacurr1.DefaultCurr))*parseFloat(this.products["pr_"+pid]["amount"]);totalAmount=parseFloat(totalAmount.toFixed(2));child_div.innerHTML=this.cartTemplate.evaluate({product:this.products["pr_"+pid]["product"].truncate(22,"..."),amount:this.products["pr_"+pid]["amount"],pid:pid,price:total,curr:curr,stockTypeLabel:stockTypeLabel});child_div.id="cartItem_inner_"+pid;parent_div.appendChild(child_div);if(this.productCount==1)$('CartContainer').innerHTML="";$('CartContainer').appendChild(parent_div);Effect.Appear('cartItem_'+pid,{duration:1.0});}
if($('totalCartAmount')){$('totalCartAmount').innerHTML='<b>Toplam :</b> <b style=\'color:red;\'>'+totalAmount+' '+ideacurr1.DefaultCurr+'</b>';}
if(DDS.length==0){if(this.products["pr_"+pid]["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 temp_div=document.createElement("div");Element.extend(temp_div);if($('Item_'+pid2)){itemDiv=$('Item_'+pid2);}else if($('Row_'+pid2)){itemDiv=$('Row_'+pid2);}
temp_div.innerHTML=itemDiv.innerHTML;document.body.appendChild(temp_div);temp_div.setStyle({position:"absolute",width:itemDiv.getWidth(),overflow:"hidden",backgroundColor:"#FFFFFF"});pos=Position.cumulativeOffset(itemDiv);temp_div.style.left=pos[0]+"px";temp_div.style.top=pos[1]+"px";cartpos=Position.cumulativeOffset($('CartContainer'));new Effect.Parallel([new Effect.MoveBy(temp_div,cartpos[1]-pos[1],cartpos[0]-pos[0],{sync:true}),new Effect.Opacity(temp_div,{sync:true,to:0.0,from:1.0,afterFinish:function(obj){obj.element.remove();}})],{duration:1.0});}
if(quickorder){if(SaveCart(escape(this.products.inspect()),'type=r'))window.location="index.php?do=catalog/order";}else SaveCart(escape(this.products.inspect()),'type=e');}
IdeaCart.prototype.AddToCart=function(pid,label,price,curr,tax,rebate,rebateType,bt,stockTypeLabel,quickorder,inProductPage){if(!inProductPage){new Ajax.Request('index.php?do=catalog/hasOption&pid='+pid,{method:'get',onSuccess:function(transport){if(transport.responseText=='1'){window.location='index.php?do=catalog/product&pid='+pid;return false;}else{ideacart1.AddToCartBasic(pid,label,price,curr,tax,rebate,rebateType,bt,stockTypeLabel,quickorder);}}});}else{ideacart1.AddToCartBasic(pid,label,price,curr,tax,rebate,rebateType,bt,stockTypeLabel,quickorder);}}
IdeaCart.prototype.RemoveFromPage=function(el){Element.extend(el);el.remove();}
IdeaCart.prototype.TruncateCart=function(obj){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(obj){if($('hiddenCart')){$('CartContainer').innerHTML="";}else{$('CartContainer').innerHTML="<center><br/>Alışveriş sepetinizde <br/> ürün bulunmamaktadır.<br/><br/></center>";}}
IdeaCart.prototype.RemoveFromCart=function(pid){if(this.products["pr_"+pid]==undefined)return;pid2=this.products["pr_"+pid]["pid"];if(this.products["pr_"+pid]){if(this.products["pr_"+pid]["amount"]>1){this.products["pr_"+pid]["amount"]=this.products["pr_"+pid]["amount"]-1;rebate=ideacart1.products["pr_"+pid]["rebate"];rebateType=ideacart1.products["pr_"+pid]["rebateType"];tax=ideacart1.products["pr_"+pid]["tax"];pr=parseFloat(this.products["pr_"+pid]["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_"+pid]["amount"]);total=total.toFixed(2);totalAmount-=parseFloat(ideacurr1.Convert(pr,ideacart1.products['pr_'+pid]['curr'],ideacurr1.DefaultCurr));totalAmount=parseFloat(totalAmount.toFixed(2));curr=this.products['pr_'+pid]['curr'];$("cartItem_inner_"+pid).innerHTML=this.cartTemplate.evaluate({product:this.products["pr_"+pid]["product"].truncate(22,"..."),amount:this.products["pr_"+pid]["amount"],pid:pid,price:total,curr:this.products["pr_"+pid]["curr"],stockTypeLabel:this.products["pr_"+pid]["stockTypeLabel"]});}else{curr=this.products["pr_"+pid]["curr"];rebate=ideacart1.products["pr_"+pid]["rebate"];rebateType=ideacart1.products["pr_"+pid]["rebateType"];tax=ideacart1.products["pr_"+pid]["tax"];pr=parseFloat(this.products["pr_"+pid]["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_"+pid]["amount"]);total=total.toFixed(2);totalAmount-=parseFloat(ideacurr1.Convert(pr,this.products['pr_'+pid]['curr'],ideacurr1.DefaultCurr));totalAmount=parseFloat(totalAmount.toFixed(2));this.products.remove('pr_'+pid);this.productCount--;new Effect.Fade('cartItem_'+pid,{duration:1.0,afterFinish:function(obj){ideacart1.RemoveFromPage(obj.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[pid]=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=e,method=post');}}}
IdeaCart.prototype.CompleteRemoveFromCart=function(pid){this.products.remove('pr_'+pid);this.productCount--;ideacart1.RemoveFromPage($('cartItem_'+pid));ideacart1.lastId=new Hash();this.products.each(function(pair){ideacart1.lastId[pair.value.pid]=pair.value.ext;});if(ideacart1.productCount<1){ideacart1.productCount=0;ideacart1.FreeCart();}}
IdeaCart.prototype.ReloadCart=function(){this.productCount=0;$('CartContainer').innerHTML="";var hiddenCart=0;var curr='';totalAmount=0;this.products.each(function(pair){pid=pair.key.substring(3);var parent_div=document.createElement('div');Element.extend(parent_div);parent_div.id='cartItem_'+pid;var child_div=document.createElement('div');Element.extend(child_div);child_div.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')){hiddenCart=hiddenCart+parseFloat(ideacart1.products["pr_"+pid]["amount"]);$('hiddenCart').value=hiddenCart;$('hiddenCartContainer').innerHTML='('+hiddenCart+')';}
total=total.toFixed(2);curr=ideacart1.products['pr_'+pid]['curr'];totalAmount+=parseFloat(ideacurr1.Convert(total,curr,ideacurr1.DefaultCurr));child_div.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"]});child_div.id="cartItem_inner_"+pid;parent_div.appendChild(child_div);ideacart1.productCount++;$('CartContainer').appendChild(parent_div);});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>');$('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.0});Effect.Fade("quantityWarn",{queue:{position:'end',scope:'myscope',limit:2},duration:1.0});}}

/**
 * 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));

/**
* kişisel
*/
function OpenProduct(id){ jQuery('#OpenProduct_Body').load('index.php?do=catalog/product.ajax&pid='+id);OpenDialog('OpenProduct');}
