var RootPath=document.location.protocol+'//'+document.location.host+'/';
var RootSkin=RootPath+'Skin/SzgLgd/';
var ImagePath=RootPath+'UrunFiles/';
function all_ch(frm,el1,tf)
{
	eleman=document.forms[frm].elements[el1];
	elemansay=eleman.length;
	if(elemansay!=undefined)
	{
		for(i=0;i<elemansay;i++)
			eleman[i].checked=tf;
	}
	else
	{
		eleman.checked=tf;
	}
	return;
}
function nitelikShow(object)
{
	ht=object.getElementsByTagName('DIV')[0];
	ha=object.getElementsByTagName('A')[0];
	ht.onmouseout		= function(){ ht.style.display='none';ha.className=''; };
	ht.onmouseover		= function(){ ht.style.display='block';ha.className='c'; };
	object.onmouseout	= function(){ ht.style.display='none';ha.className=''; };
	ht.style.display='block';
	ha.className='c';
}
/*slideshow*/
var ad_ObjectBanners=
{
	write:function()
	{
		
		if(document.location.protocol=="https:" || typeof(ad_Banners)=="undefined")	return;
		for(var j=0;j<ad_Banners.length;j++)
		{			
			var output='';
			for(var i=0;i<ad_Banners[j].length;i++)
			{
				if(!ad_Banners[j][i])	continue;
				if(ad_Banners[j][i]['tur']=='swf')
				{
					output+='<embed width="'+ad_Banners[j][i]['width']+'" height="'+ad_Banners[j][i]['height']+'" src="'+RootPath+ad_Banners[j][i]['src']+'" wmode="transparent" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash"></embed>';
				}
				else if(ad_Banners[j][i]['tur']=='iframe')
				{
					output+=ad_Banners[j][i]['kod'];
				}
				else if(ad_Banners[j][i]['tur']=='image')
				{
					output+='<a href="'+ad_Banners[j][i]['link']+'" onClick="return ad_ObjectBanners.counter('+ad_Banners[j][i]['id']+')"><img src="'+RootPath+ad_Banners[j][i]['src']+'" /></a>';
				}				
				output+='<div class=clear style="height:5px;"></div>';
			}
			if(document.getElementById('ad_banners'+j))
				document.getElementById('ad_banners'+j).innerHTML=output;			
		}
	},
	counter:function(id)
	{
		ifrm.window.location.href=RootPath+"Scripts/BannerCount.php?id="+id;
	}
}
var sliderClass = 
{
	curDist:[],curPanel:[],curDirec:[],
	change:function(direction,thisId)//direction true = right, false = left
	{
		if(!$('#'+thisId).length || $('#'+thisId).data("currentlyMoving") == true) return;
		$('#'+thisId).data("currentlyMoving",true);
		var $panels=$('#'+thisId+' ul').children();
		var totalPanels=$panels.size();
		var next=direction?this.curPanel[thisId]+1:this.curPanel[thisId]-1;
		var leftValue=$('#'+thisId+' ul').css("margin-left");
		var parseLeft=parseInt(leftValue);
		if(!direction && parseLeft>=0)//sondan alip basa ekliyoruz
		{
			leftValue=parseLeft-this.curDist[thisId];
			$('#'+thisId+' ul li').first().before("<li>"+$panels[totalPanels-1].innerHTML+"</li>");
			$('#'+thisId+' ul').css("margin-left",leftValue);
			$panels[0].parentNode.removeChild($panels[totalPanels-1]);
			next++;
		}
		else if(direction && next>totalPanels)//bastan alip sona ekliyoruz
		{
			leftValue=parseLeft+this.curDist[thisId];
			$('#'+thisId+' ul li').last().after("<li>"+$panels[0].innerHTML+"</li>");
			$('#'+thisId+' ul').css("margin-left",leftValue);
			$panels[0].parentNode.removeChild($panels[0]);
			next--;
		}
		var movement=direction?parseFloat(leftValue,10)-this.curDist[thisId]:parseFloat(leftValue,10)+this.curDist[thisId];
		$('#'+thisId+' ul').stop().animate({"margin-left":movement},function(){$('#'+thisId).data("currentlyMoving",false);});
		this.curPanel[thisId]=next;
	},	
	sliderFunc:function(thisId,movingDistance,curPanel,oto)
	{
		if(!$('#'+thisId).length){return false;}
		this.curPanel[thisId]=(curPanel)?curPanel:3;
		this.curDist[thisId]=(movingDistance)?movingDistance:190;		
		$('#'+thisId).data("currentlyMoving",false);
		$('#'+thisId+' #right').click(function(){sliderClass.curDirec[thisId]=true;sliderClass.change(true,thisId);}).mouseover(function(){this.className='hover'}).mouseout(function(){this.className=''});
		$('#'+thisId+' #left').click(function(){sliderClass.curDirec[thisId]=false;sliderClass.change(false,thisId);}).mouseover(function(){this.className='hover'}).mouseout(function(){this.className=''});
		if(oto)
		{
			setTimeout("sliderClass.sliderOto('"+thisId+"')",2000);
		}
	},
	sliderOto:function(thisId)
	{
		sliderClass.change(this.curDirec[thisId],thisId);
		setTimeout("sliderClass.sliderOto('"+thisId+"')",3000);
	}
};
/*end slideshow*/
/*smoothScroll*/
function smoothScroll(hash)
{
	$target=$('[name='+hash+']');
	if ($target.length)
	{
		var targetOffset = hash=="top"?0:$target.offset().top;
		$('html,body').animate({"scrollTop":targetOffset});
	}
}
/*end smoothScroll*/
var inputValue={
	clear:function(ob,s){if(ob.value==s) ob.value='';},
	back:function(ob,s){if(ob.value=='') ob.value=s;}
}

var lightBox={	
	open:function()
	{
		$(".ie select").css({display:"none"});
		$("#fullBgOpacity").css({height:$(document).height()+"px",display:"block"});
		$("#fullBgMessage").css({left:($("html").scrollLeft()+($(window).width()/2)-93)+"px",display:"block"});		
	},
	close:function()
	{
		$("#fullBgMessage").css({display:"none"});
		$("#fullBgOpacity").css({display:"none"});
		$(".ie select").css({display:""});
	}	
}



/*sepete atma ile ilgili*/
function ChangPrAdet(is)
{
	var q=parseInt(document.SPF.adet.value);
	q=(is)?q+1:q-1;
	if(q<1 || q>100)
	{
		alert('1-100 arasında alabilirsiniz!');
		return false;
	}
	document.SPF.adet.value=q;
}
function checkGroupBox(e)
{
	var groupId=e.name;
	if(e.type!="checkbox" || groupId=="")	return;
	var form=e.form;
	var elem=form.elements;
	for(var i=0;i<elem.length;i++)
	{
		if(elem[i].type!="checkbox" || elem[i].name!=groupId || elem[i]==e)		continue;
		elem[i].checked=false;
	}
}
function changedSelectBox(id,PI)//secim kutusu degisimi
{
	lightBox.open();
	vid=document.forms['SPF'].elements['att['+id+']'].value;
	url=RootPath+'Urun/UrunSecenekleriSelectChanged.php?PI='+PI+'&sid='+id+'&vid='+vid;
	for(k=0;k<SpfSelects.length;k++)
	{
		url+='&val['+SpfSelects[k]+']='+document.forms['SPF'].elements['att['+SpfSelects[k]+']'].value;
	}
	ifrm.window.location.href=url;
}
function changedCheckBox(ob)
{
	if(ob.type!="checkbox" || ob.name=="")
		return;
	var e=ob.form.elements;
	for(var i=0;i<e.length;i++)
	{
		if(e[i].type!="checkbox" || e[i].name!=ob.name || e[i]==ob)
			continue;
		e[i].checked=false;
	}
}

function CheckBasket()
{
	if(typeof SpfSelects!="undefined")
	{
		for(var i=0;i<SpfSelects.length;i++)
		{
			var SpfSelect=document.forms['SPF'].elements['att['+SpfSelects[i]+']'];
			if(SpfSelect.value=='')
			{
				alert('Lütfen '+SpfSelect[0].innerHTML);
				SpfSelect.focus();
				return false;
			}
		}
	}
	if(typeof SpfTexts!="undefined")
	{
		for(var i=0;i<SpfTexts.length;i++)
		{
			var SpfText=document.forms['SPF'].elements['aty['+SpfTexts[i]+']'];
			if(SpfText.value=='' && SpfText.disabled!=true)
			{
				alert('Lütfen "'+SpfText.getAttribute("label")+'" giriniz.');
				SpfText.focus();
				return false;
			}
		}
		if(document.forms['SPF'].elements['confirmText'].checked==false)
		{
			alert("Lütfen Ürün yazılarının doğruluğunu onaylayın.");
			smoothScroll('confirmText');
			return false;
		}
	}
	lightBox.open();
	return true;
}
/*end sepete atma*/
function CharLimit(ob,limit)
{
	sid=ob.getAttribute('sid');
	if(ob.value.length>limit)
		ob.value=ob.value.substring(0,limit);
	document.getElementById(sid).innerHTML=limit-ob.value.length;
}
var nmRegions=new Array('Ülke','Şehir','İlçe','Semt');
function jsRegion(obj,thid)
{
	if(typeof(thid)=='undefined' || thid=='') thid='region';
	lightBox.open();
	ifrm.window.location.href=RootPath+'Scripts/region.php?is=2&r='+obj.value+'&e='+obj.id.replace(thid,'')+"&thid="+thid;	
}

function toolBarBox(context)
{
	if(typeof(context) == "undefined")	context = "";
	var autobox = $(context + " ul.autobox");
	autobox.each(function(i,v){
		var thisAutobox = $(v);
		var opt = $.extend({on_class: "on", auto_focus: 0, callback: function(){}}, thisAutobox.metadata());
		thisAutobox.find("a").click(function(){
			$(this)[0].blur();
			var jParent = $(this).closest("li");
			var jBox = $("#" + jParent.metadata().box);
			jParent.siblings().removeClass(opt.on_class);
			jParent.addClass(opt.on_class);			
			if (typeof(opt.callback) == "function")// We have a callback function to call
			{
				opt.callback.call(this);
			}			
			if (jBox.length)
			{
				jBox.siblings("div[id^='b_']").hide();
				if (!jBox.is(":visible"))
				{
					jBox.show();
					jBox.trigger("box.open");
				}
				else
				{
					jBox.show();
					jBox.trigger("box.focus");
				}
			}
			if((opt.use_hash == true) && (typeof(jParent.metadata().hash) != "undefined") && (jParent.metadata().hash != null) )
			{
				document.location.hash = jParent.metadata().hash;
			}			
			return false;
		});		
		if ( (opt.use_hash == true) && (document.location.hash.length > 0) )
		{
			thisAutobox.find("#t_" + document.location.hash.substr(1) + " a").trigger("click");
		}		
		
		if (!thisAutobox.find("li." + opt.on_class).length && opt.auto_focus)// Simulate click on first tab
		{
			thisAutobox.find("a:first").trigger("click");
		}
	});
}
function toolbarActions()
{
	if(!$("#user_toolbar").length) {return false;}
	var animating = false;
	// Set boxes widths
	$("#user_toolbar_layer > .toolbar_ajax_box").width($("#user_toolbar").innerWidth() - 12);
	$("#feedback_ajax_box").width(322).css({marginLeft:"495px"});	
	$("#tbarModal").css({height:$(document).height()+"px",opacity:0.8});// Init modal	
	// Hide modal layer and boxes
	$("#user_toolbar_layer a.i_close").click(function(){
		$("#user_toolbar_layer > .toolbar_ajax_box, #tbarModal").hide();
		$("#user_toolbar a").removeClass("on");
		return false;
	});
	
	// Add actions on main left tabs
	$("#user_toolbar a").not(".direct").click(function(){
		var jThis = $(this);		
		if (jThis.is(".on"))// Tab is on - hide modal layer and boxes
		{
			$("#user_toolbar_layer > .toolbar_ajax_box").hide();
			$("#user_toolbar li a").removeClass("on");
			$("#tbarModal").hide();
		}		
		else// Tab is off
		{
			var section = $(this).metadata().section;
			if(!section)
			{
				return true;
			}
			var tab = $("#t_" + section + "_" + $.cookie(section + "_section") + " a");			
			if ($("#" + section + "_ajax_box .autobox li").length)// Return false if box doesn't exist for current tab
			{
				$("#" + section + "_ajax_box .bxd > span.light").hide();
			}			
			$("#user_toolbar_layer > .toolbar_ajax_box").hide();// Hide all boxes			
			$("#tbarModal").show().css({height:$(document).height()+"px"});// Show modal layer			
			$("#user_toolbar li a").removeClass("on");// Mark as off all tabs			
			jThis.addClass("on");// Mark as on current tab			
			$("#" + section + "_ajax_box").show();// Show box for current tab			
			if (tab.length>0)// If found, open
			{
				tab.triggerHandler("click");				
			}			
			else// If not found, open first section
			{				
				$("#" + section + "_ajax_box .autobox a:first").triggerHandler("click");// Open first tab if no or invalid cookie				
			}
			if (jThis.is("#feedback_ajax_tab"))
			{
				$("#feedback_container").html('<iframe src="http://settings.messenger.live.com/Conversation/IMMe.aspx?invitee=62e37ba514b42cb2@apps.messenger.live.com&mkt=tr-TR" width="320" height="400" style="width: 320px; height: 400px;" frameborder="0" scrolling="no"></iframe>');
			}
		}		
		return false;
	});
	$("#user_toolbar_layer .toolbar_ajax_box .bxd > div").bind("box.open", function(){
		var dat = $(this).attr("id").split("_");
		if (!$(this).find("ul.result_list").length)
		{
			$.get(RootPath+"Scripts/ToolBar.php?section="+dat[1], function(data){}, "script");
		}
	});	
	$("#user_toolbar_layer a.med_arr_prev, #user_toolbar_layer a.med_arr_next").live("click",function(){
		$(this).closest("div").find("ul").replaceWith('<div class=a_center><img src="'+RootSkin+'images/ajax_loader.gif" /></div>');
		$.get(RootPath+"Scripts/ToolBar.php?section="+$(this).metadata().section+"&start="+$(this).metadata().start, function(data){}, "script");
		return false;
	});	
	$("#user_toolbar_layer a.med_arr_prev_off, #user_toolbar_layer a.med_arr_next_off").live("click",function(){return false;});
}



$(function(){
	toolBarBox();
	toolbarActions();
	$("ul.tabs").tabs("div.tabs > div");
	$(".brkTip[title]").tooltip();
	$('a[href*=#]').click(function(){		
		if (location.pathname.replace(/^\//,'')==this.pathname.replace(/^\//,'') && location.hostname == this.hostname)
		{
			smoothScroll(this.hash.slice(1));
			return false;
		}
	});
	if(typeof ad_ObjectBanners=="object")
		ad_ObjectBanners.write();
});


// ################################################################################
;(function($){$.fn.bgIframe=$.fn.bgiframe=function(s){if($.browser.msie && parseInt($.browser.version)===6){s=$.extend({top:'auto',left:'auto',width:'auto',height:'auto',opacity:true,src:'javascript:false;'},s||{});var prop=function(n){return n&&n.constructor==Number?n+'px':n;},html='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+s.src+'"'+'style="display:block;position:absolute;z-index:-1;'+(s.opacity!==false?'filter:Alpha(Opacity=\'0\');':'')+'top:'+(s.top=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+\'px\')':prop(s.top))+';'+'left:'+(s.left=='auto'?'expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+\'px\')':prop(s.left))+';'+'width:'+(s.width=='auto'?'expression(this.parentNode.offsetWidth+\'px\')':prop(s.width))+';'+'height:'+(s.height=='auto'?'expression(this.parentNode.offsetHeight+\'px\')':prop(s.height))+';'+'"/>';return this.each(function(){if($('> iframe.bgiframe',this).length==0)this.insertBefore(document.createElement(html),this.firstChild);});}return this;};})(jQuery);
;(function(e){e.extend({metadata:{defaults:{type:"class",name:"metadata",cre:/({.*})/,single:"metadata"},setType:function(b,a){this.defaults.type=b;this.defaults.name=a},get:function(b,a){a=e.extend({},this.defaults,a);if(!a.single.length)a.single="metadata";var c=e.data(b,a.single);if(c)return c;c="{}";var h=function(d){if(typeof d!="string")return d;return d=eval("("+d+")")};if(a.type=="html5"){var g={};e(b.attributes).each(function(){var d=this.nodeName;if(d.match(/^data-/))d=d.replace(/^data-/,
"");else return true;g[d]=h(this.nodeValue)})}else{if(a.type=="class"){var f=a.cre.exec(b.className);if(f)c=f[1]}else if(a.type=="elem"){if(!b.getElementsByTagName)return;f=b.getElementsByTagName(a.name);if(f.length)c=e.trim(f[0].innerHTML)}else if(b.getAttribute!=undefined)if(f=b.getAttribute(a.name))c=f;g=h(c.indexOf("{")<0?"{"+c+"}":c)}e.data(b,a.single,g);return g}}});e.fn.metadata=function(b){return e.metadata.get(this[0],b)}})(jQuery);

;jQuery.easing.jswing=jQuery.easing.swing;
jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,a,c,b,d){return jQuery.easing[jQuery.easing.def](e,a,c,b,d)},easeInQuad:function(e,a,c,b,d){return b*(a/=d)*a+c},easeOutQuad:function(e,a,c,b,d){return-b*(a/=d)*(a-2)+c},easeInOutQuad:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a+c;return-b/2*(--a*(a-2)-1)+c},easeInCubic:function(e,a,c,b,d){return b*(a/=d)*a*a+c},easeOutCubic:function(e,a,c,b,d){return b*((a=a/d-1)*a*a+1)+c},easeInOutCubic:function(e,a,c,b,d){if((a/=d/2)<1)return b/
2*a*a*a+c;return b/2*((a-=2)*a*a+2)+c},easeInQuart:function(e,a,c,b,d){return b*(a/=d)*a*a*a+c},easeOutQuart:function(e,a,c,b,d){return-b*((a=a/d-1)*a*a*a-1)+c},easeInOutQuart:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a*a+c;return-b/2*((a-=2)*a*a*a-2)+c},easeInQuint:function(e,a,c,b,d){return b*(a/=d)*a*a*a*a+c},easeOutQuint:function(e,a,c,b,d){return b*((a=a/d-1)*a*a*a*a+1)+c},easeInOutQuint:function(e,a,c,b,d){if((a/=d/2)<1)return b/2*a*a*a*a*a+c;return b/2*((a-=2)*a*a*a*a+2)+c},easeInSine:function(e,
a,c,b,d){return-b*Math.cos(a/d*(Math.PI/2))+b+c},easeOutSine:function(e,a,c,b,d){return b*Math.sin(a/d*(Math.PI/2))+c},easeInOutSine:function(e,a,c,b,d){return-b/2*(Math.cos(Math.PI*a/d)-1)+c},easeInExpo:function(e,a,c,b,d){return a==0?c:b*Math.pow(2,10*(a/d-1))+c},easeOutExpo:function(e,a,c,b,d){return a==d?c+b:b*(-Math.pow(2,-10*a/d)+1)+c},easeInOutExpo:function(e,a,c,b,d){if(a==0)return c;if(a==d)return c+b;if((a/=d/2)<1)return b/2*Math.pow(2,10*(a-1))+c;return b/2*(-Math.pow(2,-10*--a)+2)+c},
easeInCirc:function(e,a,c,b,d){return-b*(Math.sqrt(1-(a/=d)*a)-1)+c},easeOutCirc:function(e,a,c,b,d){return b*Math.sqrt(1-(a=a/d-1)*a)+c},easeInOutCirc:function(e,a,c,b,d){if((a/=d/2)<1)return-b/2*(Math.sqrt(1-a*a)-1)+c;return b/2*(Math.sqrt(1-(a-=2)*a)+1)+c},easeInElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d)==1)return c+b;f||(f=d*0.3);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);return-(g*Math.pow(2,10*(a-=1))*Math.sin((a*d-e)*2*Math.PI/f))+c},easeOutElastic:function(e,
a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d)==1)return c+b;f||(f=d*0.3);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);return g*Math.pow(2,-10*a)*Math.sin((a*d-e)*2*Math.PI/f)+b+c},easeInOutElastic:function(e,a,c,b,d){e=1.70158;var f=0,g=b;if(a==0)return c;if((a/=d/2)==2)return c+b;f||(f=d*0.3*1.5);if(g<Math.abs(b)){g=b;e=f/4}else e=f/(2*Math.PI)*Math.asin(b/g);if(a<1)return-0.5*g*Math.pow(2,10*(a-=1))*Math.sin((a*d-e)*2*Math.PI/f)+c;return g*Math.pow(2,-10*(a-=1))*Math.sin((a*
d-e)*2*Math.PI/f)*0.5+b+c},easeInBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;return b*(a/=d)*a*((f+1)*a-f)+c},easeOutBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;return b*((a=a/d-1)*a*((f+1)*a+f)+1)+c},easeInOutBack:function(e,a,c,b,d,f){if(f==undefined)f=1.70158;if((a/=d/2)<1)return b/2*a*a*(((f*=1.525)+1)*a-f)+c;return b/2*((a-=2)*a*(((f*=1.525)+1)*a+f)+2)+c},easeInBounce:function(e,a,c,b,d){return b-jQuery.easing.easeOutBounce(e,d-a,0,b,d)+c},easeOutBounce:function(e,a,c,b,d){return(a/=
d)<1/2.75?b*7.5625*a*a+c:a<2/2.75?b*(7.5625*(a-=1.5/2.75)*a+0.75)+c:a<2.5/2.75?b*(7.5625*(a-=2.25/2.75)*a+0.9375)+c:b*(7.5625*(a-=2.625/2.75)*a+0.984375)+c},easeInOutBounce:function(e,a,c,b,d){if(a<d/2)return jQuery.easing.easeInBounce(e,a*2,0,b,d)*0.5+c;return jQuery.easing.easeOutBounce(e,a*2-d,0,b,d)*0.5+b*0.5+c}});

;jQuery.cookie=function(d,c,a){if(typeof c!="undefined"){a=a||{};if(c===null){c="";a.expires=-1}var b="";if(a.expires&&(typeof a.expires=="number"||a.expires.toUTCString)){if(typeof a.expires=="number"){b=new Date;b.setTime(b.getTime()+a.expires*24*60*60*1E3)}else b=a.expires;b="; expires="+b.toUTCString()}var e=a.path?"; path="+a.path:"",f=a.domain?"; domain="+a.domain:"";a=a.secure?"; secure":"";document.cookie=[d,"=",encodeURIComponent(c),b,e,f,a].join("")}else{c=null;if(document.cookie&&document.cookie!=
""){a=document.cookie.split(";");for(b=0;b<a.length;b++){e=jQuery.trim(a[b]);if(e.substring(0,d.length+1)==d+"="){c=decodeURIComponent(e.substring(d.length+1));break}}}return c}};


