

function getPage(iurl) {
document.location.href = iurl;
}

$(document).ready(function () {
		jkmegamenu.render($);
		indirimdedivler = $('div.uindirimde');
		indirimdedivler.each(function() {
			$(this).html(swftext('indirimde.swf'));
		});
		upuandivler = $('div.upuan');
		upuandivler.each(function() {
			$(this).html(puantext($(this).text()));
		});
		yerlestir();
	});	


(function($) {
	$.fn.thumbPopup = function(options)
	{
		settings = jQuery.extend({
			popupId: "thumbPopup",
			popupCSS: {'padding':'2px', 'border': '1px solid #C0C0C0', 'z-order':'10000', 'z-index': '10000', 'background': '#FFFFFF'},
			cursorTopOffset: 0,
			cursorLeftOffset: 60,
			loadingHtml: "<span style='padding: 40px;'>...</span>"
		}, options);
		popup =
		$("<div />")
		.css(settings.popupCSS)
		.attr("id", settings.popupId)
		.css("position", "absolute")
		.appendTo("body").hide();
		$(this)
		.hover(setPopup)
		.mousemove(updatePopupPosition)
		.mouseout(hidePopup);
		
		function setPopup(event)
		{
			var fullImgURL = $(this).attr("s2");
			if (fullImgURL.length < 4) { return false; };
			$(this).data("hovered", true);
			$("<img />")
			.bind("load", {thumbImage: this}, function(event)
			{
				if ($(event.data.thumbImage).data("hovered") == true) {
					$(popup).empty().append(this);
					updatePopupPosition(event);
					$(popup).show();
				}
				$(event.data.thumbImage).data("cached", true);
			})
			.attr("src", fullImgURL);
			if ($(this).data("cached") != true) {
				$(popup).append($(settings.loadingHtml));
				$(popup).show();
			}
			
			updatePopupPosition(event);			
		}
		
		function updatePopupPosition(event)
		{
			var windowSize = getWindowSize();
			var popupSize = getPopupSize();
			if (windowSize.width + windowSize.scrollLeft < event.pageX + popupSize.width + settings.cursorLeftOffset){
				$(popup).css("left", event.pageX - popupSize.width - settings.cursorLeftOffset);
			} else {
				$(popup).css("left", event.pageX + settings.cursorLeftOffset);
			}
			if (windowSize.height + windowSize.scrollTop < event.pageY + popupSize.height + settings.cursorTopOffset){
				$(popup).css("top", event.pageY - (popupSize.height/2) - settings.cursorTopOffset);
			} else {
				$(popup).css("top", event.pageY - (popupSize.height/2) - settings.cursorTopOffset);
			}
		}
		
		function hidePopup(event)
		{
			$(this).data("hovered", false);
			$(popup).empty().hide();
		}
		
		function getWindowSize() {
			return {
				scrollLeft: $(window).scrollLeft(),
				scrollTop: $(window).scrollTop(),
				width: $(window).width(),
				height: $(window).height()
			};
		}
		
		function getPopupSize() {
			return {
				width: $(popup).width(),
				height: $(popup).height()
			};
		}

		//Return original selection for chaining
		return this;
	};
})(jQuery);

$(function(){
	$("img[tip='kb']").thumbPopup({});
});
  
	var kutu_yuvarla=10;

   addEvent(window, 'load', yerlestir);
 




/* jQuery Mega Menu v1.02
* Last updated: June 29th, 2009. This notice must stay intact for usage 
* Author: JavaScript Kit at http://www.javascriptkit.com/
* Visit http://www.javascriptkit.com/script/script2/jScale/ for full source code
*/
var jkmegamenu={

effectduration: 300, //duration of animation, in milliseconds
delaytimer: 200, //delay after mouseout before menu should be hidden, in milliseconds

//No need to edit beyond here
megamenulabels: [],
megamenus: [], //array to contain each block menu instances
zIndexVal: 1000, //starting z-index value for drop down menu
$shimobj: null,

addshim:function($){
	$(document.body).append('<IFRAME id="outlineiframeshim" src="'+(location.protocol=="https:"? 'blank.htm' : 'about:blank')+'" style="display:none; left:0; top:0; z-index:999; position:absolute; filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)" frameBorder="0" scrolling="no"></IFRAME>')
	this.$shimobj=$("#outlineiframeshim")
},

alignmenu:function($, e, megamenu_pos){
	var megamenu=this.megamenus[megamenu_pos]
	var $anchor=megamenu.$anchorobj
	var $menu=megamenu.$menuobj
	var menuleft=($(window).width()-(megamenu.offsetx-$(document).scrollLeft())>megamenu.actualwidth)? megamenu.offsetx : megamenu.offsetx-megamenu.actualwidth+megamenu.anchorwidth //get x coord of menu
	//var menutop=($(window).height()-(megamenu.offsety-$(document).scrollTop()+megamenu.anchorheight)>megamenu.actualheight)? megamenu.offsety+megamenu.anchorheight : megamenu.offsety-megamenu.actualheight
	var menutop=megamenu.offsety+megamenu.anchorheight  //get y coord of menu
	$menu.css({"left":menuleft+"px", "top":menutop+"px"})
	this.$shimobj.css({"width":megamenu.actualwidth+"px", "height":megamenu.actualheight+"px", "left":menuleft+"px", "top":menutop+"px", "display":"block"})
},

showmenu:function(e, megamenu_pos){

	var megamenu=this.megamenus[megamenu_pos]
	var $menu=megamenu.$menuobj
	var $menuinner=megamenu.$menuinner
	if ($menu.css("display")=="none"){
		this.alignmenu(jQuery, e, megamenu_pos)
		//$menu.css("z-index", ++this.zIndexVal)
		$menu.show(this.effectduration, function(){
			$menuinner.css('visibility', 'visible')
		})
	}
	else if ($menu.css("display")=="block" && e.type=="click"){ //if menu is hidden and this is a "click" event (versus "mouseout")
		this.hidemenu(e, megamenu_pos)
	}
	return false
},

hidemenu:function(e, megamenu_pos){
	var megamenu=this.megamenus[megamenu_pos]
	var $menu=megamenu.$menuobj
	var $menuinner=megamenu.$menuinner
	$menuinner.css('visibility', 'hidden')
	this.$shimobj.css({display:"none", left:0, top:0})
	$menu.hide(this.effectduration)
},

definemenu:function(anchorid, menuid, revealtype){
	this.megamenulabels.push([anchorid, menuid, revealtype])
},

render:function($){
	for (var i=0, labels=this.megamenulabels[i]; i<this.megamenulabels.length; i++, labels=this.megamenulabels[i]){
		if ($('#'+labels[0]).length!=1 || $('#'+labels[1]).length!=1) //if one of the two elements are NOT defined, exist
			return
		this.megamenus.push({$anchorobj:$("#"+labels[0]), $menuobj:$("#"+labels[1]), $menuinner:$("#"+labels[1]).children('ul:first-child'), revealtype:labels[2], hidetimer:null})
		var megamenu=this.megamenus[i]	
		megamenu.$anchorobj.add(megamenu.$menuobj).attr("_megamenupos", i+"pos") //remember index of this drop down menu
		megamenu.actualwidth=megamenu.$menuobj.outerWidth()
		megamenu.actualheight=megamenu.$menuobj.outerHeight()
		megamenu.offsetx=megamenu.$anchorobj.offset().left
		megamenu.offsety=megamenu.$anchorobj.offset().top
		megamenu.anchorwidth=megamenu.$anchorobj.outerWidth()
		megamenu.anchorheight=megamenu.$anchorobj.outerHeight()
		$(document.body).append(megamenu.$menuobj) //move drop down menu to end of document
		megamenu.$menuobj.css("z-index", ++this.zIndexVal).hide()
		megamenu.$menuinner.css("visibility", "hidden")
		megamenu.$anchorobj.bind(megamenu.revealtype=="click"? "click" : "mouseenter", function(e){
			var menuinfo=jkmegamenu.megamenus[parseInt(this.getAttribute("_megamenupos"))]
			clearTimeout(menuinfo.hidetimer) //cancel hide menu timer
			return jkmegamenu.showmenu(e, parseInt(this.getAttribute("_megamenupos")))
		})
		megamenu.$anchorobj.bind("mouseleave", function(e){
			var menuinfo=jkmegamenu.megamenus[parseInt(this.getAttribute("_megamenupos"))]
			if (e.relatedTarget!=menuinfo.$menuobj.get(0) && $(e.relatedTarget).parents("#"+menuinfo.$menuobj.get(0).id).length==0){ //check that mouse hasn't moved into menu object
				menuinfo.hidetimer=setTimeout(function(){ //add delay before hiding menu
					jkmegamenu.hidemenu(e, parseInt(menuinfo.$menuobj.get(0).getAttribute("_megamenupos")))
				}, jkmegamenu.delaytimer)
			}
		})
		megamenu.$menuobj.bind("mouseenter", function(e){
			var menuinfo=jkmegamenu.megamenus[parseInt(this.getAttribute("_megamenupos"))]
			clearTimeout(menuinfo.hidetimer) //cancel hide menu timer
		})
		megamenu.$menuobj.bind("mouseleave", function(e){
			var menuinfo=jkmegamenu.megamenus[parseInt(this.getAttribute("_megamenupos"))]
			menuinfo.hidetimer=setTimeout(function(){ //add delay before hiding menu
				jkmegamenu.hidemenu(e, parseInt(menuinfo.$menuobj.get(0).getAttribute("_megamenupos")))
			}, jkmegamenu.delaytimer)
		})
	} //end for loop
	if(/Safari/i.test(navigator.userAgent)){ //if Safari
		$(window).bind("resize load", function(){
			for (var i=0; i<jkmegamenu.megamenus.length; i++){
				var megamenu=jkmegamenu.megamenus[i]
				var $anchorisimg=(megamenu.$anchorobj.children().length==1 && megamenu.$anchorobj.children().eq(0).is('img'))? megamenu.$anchorobj.children().eq(0) : null
				if ($anchorisimg){ //if anchor is an image link, get offsets and dimensions of image itself, instead of parent A
					megamenu.offsetx=$anchorisimg.offset().left
					megamenu.offsety=$anchorisimg.offset().top
					megamenu.anchorwidth=$anchorisimg.width()
					megamenu.anchorheight=$anchorisimg.height()
				}
			}
		})
	}
	else{
		$(window).bind("resize", function(){
			for (var i=0; i<jkmegamenu.megamenus.length; i++){
				var megamenu=jkmegamenu.megamenus[i]	
				megamenu.offsetx=megamenu.$anchorobj.offset().left
				megamenu.offsety=megamenu.$anchorobj.offset().top
			}
		})
	}
	jkmegamenu.addshim($)
}

}

  
  
function yerlestir() {
	var facetweet = $('#facetweet');
	var siteanatable = $('#siteanagovdetable');
	var siteanatablepos = siteanatable.position();
	facetweet.css({"display":"inline", "position":"absolute", "top":(siteanatablepos.top+5), "left": (siteanatablepos.left-236)}); 
	
    upuandivler = $('div.upuan');
	upuandivler.each(function() { 
	var upuandivparent = $(this).parent();
	var upuandivparentpos = upuandivparent.position();
		$(this).css({"display":"inline", "position":"absolute", "top": upuandivparentpos.top - 5, "left": (upuandivparentpos.left+upuandivparent.width())-$(this).width()}); 
	});


	indirimdedivler = $('div.uindirimde');
	indirimdedivler.each(function() {
		var imgsi = $(this).parent().find('img:first');
		var imgsipos = imgsi.position();
		$(this).css({"display":"inline", "position":"absolute", "top": imgsipos.top+1, "left": imgsipos.left+1}); 
	});
	

	
}


$(window).resize(function() {
	yerlestir();

});


function puantext(swfpuan) {
	iswftxt = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="50" height="50" id="indirimdeswf" align="middle">';
	iswftxt += '<param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="SiteSWF/puan.swf" />';
	iswftxt += '<param name="FlashVars" value="puan=' + swfpuan + '" />';
	iswftxt += '<param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" />';
	iswftxt += '<embed src="SiteSwf/puan.swf" FlashVars="puan=' + swfpuan + '" quality="high" wmode="transparent" bgcolor="#ffffff" width="50" height="50" name="indirimdeswf" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
	return iswftxt;
}

function swftext(swfurl) {
	iswftxt = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="95" height="55" id="indirimdeswf" align="middle">';
	iswftxt += '<param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="SiteSWF/'+swfurl+'" />';
	iswftxt += '<param name="quality" value="high" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ffffff" />';
	iswftxt += '<embed src="SiteSwf/'+swfurl+'" quality="high" wmode="transparent" bgcolor="#ffffff" width="95" height="55" name="indirimdeswf" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
return iswftxt;
}
var p_browser=navigator.appName.toLowerCase();
function popen(p_url, p_title) { 
	if (p_browser.indexOf('microsoft') != -1) {	p_height = 505;	} else { p_height = 495; }
	pwin=dhtmlwindow.open("a", "iframe", p_url, p_title, "width=560px,height=" + p_height + "px,resize=1,scrolling=1,center=1");
}
function popenx(p_url, p_title, p_height) {

	if (p_browser.indexOf('microsoft') != -1) { p_height =  p_height + 10; } 
	pwin=dhtmlwindow.open("b", "iframe", p_url, p_title, "width=650px,height=" + p_height + "px,resize=1,scrolling=1,center=1");
}
function popenp(p_url, p_title, p_width, p_height) {
	p_width = p_width+10;
	p_height = p_height+10;
	if (p_browser.indexOf('microsoft') != -1) { p_height =  p_height + 10; } 
	pwin=dhtmlwindow.open("c", "iframe", p_url, p_title, "width=" + p_width + "px,height=" + p_height + "px,resize=1,scrolling=1,center=1");
}

function satinal(uno) {
	pwin=dhtmlwindow.open("lox", "iframe", "hemenal.asp?id="+uno, all_title, "width=300px,height=140px,center=1");
}
function setselectval(tform, tselect, tval) {
	for (var i= 0; i < document[tform][tselect].options.length; i++) {
		if (document[tform][tselect].options[i].value == tval) {
			document[tform][tselect].selectedIndex = i;
			break;
		}
	}
}
function isNumberKey(evt) {
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
    return false;
    return true;
}
function Left(str, n){
	if (n <= 0)
	    return "";
	else if (n > String(str).length)
	    return str;
	else
	    return String(str).substring(0,n);
}
function Right(str, n){
    if (n <= 0)
       return "";
    else if (n > String(str).length)
       return str;
    else {
       var iLen = String(str).length;
       return String(str).substring(iLen, iLen - n);
    }
}
