// NewCMS created by Şevket Bulamaz - 2009

$(document).ready(function(){
	var msie6 = false;
	if(jQuery.browser.msie == true && jQuery.browser.version == "6.0"){
		msie6 = true;
	}
	
	/*$('.leftUrun').css('cursor','pointer').click(function(){
		//window.open('mailto:b.yildiz@gok-er.com');
		location.href = 'mailto:b.yildiz@gok-er.com';
	});
	
	$('.rightUrun').css('cursor','pointer').click(function(){
		//window.open('mailto:b.yildiz@gok-er.com');
		location.href = 'mailto:b.yildiz@gok-er.com';
	});*/
	
	$('#rightBox').click(function(){
		var xx = $('#gallery ul').css('margin-left');
		if(xx == "0px"){$('#gallery ul').animate({marginLeft: "-252px"},1000);}
	});
	
	$('#leftBox').click(function(){
		var xx = $('#gallery ul').css('margin-left');
		if(xx != "0px"){$('#gallery ul').animate({marginLeft: "0px"},1000);}
	});
	
	
	$('#urunler').mouseover( function(){
		$('#popup').css('z-index','99999');
		$('#popup').show();
		$('#popup_kapat').show().css('z-index','99998');
		$('#popup_kapat2').show().css('z-index','99998');
		$(this).addClass('selected');
	});

	
	$('#popup_kapat, #popup_kapat2, #m1, #m3, #m4, #m5, #m6 ').mouseover( function() {
		$('#popup').hide().css('z-index','0');;
		$('#popup_kapat').hide().css('z-index','0');
		$('#popup_kapat2').hide().css('z-index','0');
		$('#urunler').removeClass('selected');
	} );
	
	
	uyeyiz();

});

var uyeKontrol = 0;
function uyeyiz(){
	
	$('#uye_1, #uye_2').css('opacity','0.0')

	if(uyeKontrol==0){
		$('#uye_2').hide();
		$('#uye_1').show();
		$('#uye_1').animate({opacity: '+=1.0'},{duration:1500});
		uyeKontrol = 1;
		setTimeout("uyeyiz()",3500);
		return;
	}
	
	if(uyeKontrol==1){
		$('#uye_1').hide();
		$('#uye_2').show();
		$('#uye_2').animate({opacity: '+=1.0'},{duration:1500});
		uyeKontrol = 0;
	};
	
	setTimeout("uyeyiz()",3500);

};



$(function() {
        $('#gallery a').lightBox();
		$('.LBox a').each(function(){
		
			$(this).attr("title",$(this).html());
		
		});
		$('.LBox a').lightBox();
});

function jAlert(veri){
	var msg="";
	var ekleme = 0;
	
	if($("#jAlert").css("display") == "block"){
		ekleme = 1;
	}
	veri = veri.replace(/</g, "&lt;").replace(/>/g, "&gt;");
	if(ekleme == 0){
		msg += "<div id='jAlert' style='border:2px solid #fff;'>";
		msg += "<h3 style='font-size:22px; text-align:center; font-weight:bold; color:#ff0000; padding-left:20px;'><span style='float:left;'>Uyarı</span><input type='button' value='X' onclick='$(\"#jAlert\").remove();' class='jInput' style='float:right;' /></h3>";
		msg += "<p id='veri' style='padding:10px; font-size:12px; font-family:Arial, Helvatica; clear:both;'>" + veri + "</p>";
		msg += "<p align='right' style='padding:10px 10px 10px 0px;'></p>";
		msg += "</div>";
		$('body').append(msg);
		var hgt = $("#jAlert").height() / 2;
		$("#jAlert").css("margin-top","-" + hgt + "px");
	}else if(ekleme == 1){
		$("#veri").append("<br />" + veri);
		var hgt = $("#jAlert").height() / 2;
		$("#jAlert").css("margin-top","-" + hgt + "px");
	}else{
		
	}
}

function pngFixle(gelen){
		asilSrc = document.getElementById(gelen).getAttribute('src');
		var control = asilSrc.substring(asilSrc.length-3,asilSrc.length);
		if(control == "gif"){
			asilSrc = document.getElementById(gelen).getAttribute('rel');
		}
		document.getElementById(gelen).setAttribute('rel',asilSrc);
		document.getElementById(gelen).setAttribute('src','images/main/blank.gif');
		gelenCss = document.getElementById(gelen).style.cssText;
		document.getElementById(gelen).style.cssText = "filter: progid:DXImageTransform.Microsoft.AlphaImageLoader (src='"+ asilSrc +"'); " + gelenCss;
}
