var sliderTimerID;
var sliderIndex;
var currentIndex=0;
var altMansetSelected =1;
function _onloadHook(){return;}
$(function(){
//var facebookLikeHur=$("#facebookLikeHur");
//facebookLikeHur.html("<iframe src=\"http://www.facebook.com/plugins/like.php?href=http://www.facebook.com/hurriyet&amp;layout=button_count&amp;show_faces=false&amp;width=108&amp;height=21&amp;action=like&amp;font=trebuchet+ms&amp;colorscheme=light\" scrolling=\"no\" allowTransparency=\"true\" frameborder=\"0\" style=\"border:none; overflow:hidden; width:108px; height:23px; margin-top:6px; padding-left:5px; padding-bottom:1px;background:transparent'\"></iframe>");
$(".ImgKManset").mouseover(function(){
							//$(".HaberKatMnset").attr("style","display:none");
							$("#BesliMansetHaber" + altMansetSelected).css("display","none");
							var selectedHaberID =  $(this).attr("id").replace("Link","Haber");
							$("#" + selectedHaberID).css("display","block");
							altMansetSelected = parseInt(selectedHaberID.replace("BesliMansetHaber",""));
						});
for(var i = 1; i<6; i++)
					{
					$("#BesliMansetLink"+i).attr("href", $("#BesliMansetHaber"+i).find("a:first").attr("href"));
					}
$(".FlashMansetNew, .FlashMansetLastNew").hover(
function()
{
var elem = $(this);
$(elem.find('h1')).css("color","#F00");

},
function()
{
var elem = $(this);
$(elem.find('h1')).css("color","#000000");
}
);

$("img", $("#firstBannerLink")).css({top:"-30px"});
$(".MainManset a").hover(function(){
CheckSliderOpen();});
$("#NewsContentsMansetBut li a:lt(12)").hover(function(){
CheckSliderOpen();
$.each($("#NewsContentsMansetBut li a"), function(index, value) {
$("img", this).css({top:"0px"}); 
});
$("img", this).css({top:"-30px"});
currentIndex = parseInt($("img", this).attr("id").replace('Img', '')) + 1;
}, function() {});
function CheckSliderOpen()
{
if ($("#PlayImg").hasClass("sliderOpen"))   
{ 
$("#PlayImg").attr("src", "/p/2011/stop.gif");
StopSliderTimer();
}
} 
for (var i=1;i<=12;i++)
{
$('#bannerLi'+i+' a').attr("href", $('#DivManset'+i+' a').attr("href"));
}

$("img", $("#BesliMansetLink1")).css({left:"-43px"});
$(".HaberKatManset_Bttn  a").hover(function(){
$.each($(".HaberKatManset_Bttn  a"), function(index, value) {
$("img", this).css({left:"0px"}); 
});
$("img", this).css({left:"-43px"});
}, function() {});
$("#PlayButton").click(function(e){
if ($("#PlayImg").hasClass("sliderOpen"))   
{ 
$("#PlayImg").attr("src", "/p/2011/stop.gif");
$("#PlayImg").removeClass("sliderOpen");
StopSliderTimer();
}
else
{ 
$("#PlayImg").attr("src", "/p/2011/play.gif");
$("#PlayImg").addClass("sliderOpen");
StartSliderTimer();
}
e.preventDefault();
e.stopPropagation();
}); 
});
function CheckSlider()
{ 
}
function StartSliderTimer()
{
sliderTimerID = setInterval( ChangeSliderContent, 2000); 
if(currentIndex==0)
{currentIndex = 2;}
else if(currentIndex==13)
{currentIndex = 1;}
function ChangeSliderContent(){
for(var i=1;i<=12;i++)
{
$("#DivManset"+i).hide();
$("img", $("#bannerLi"+i)).css({top:"0px"});
}
$("img", $("#bannerLi"+currentIndex)).css({top:"-30px"});
$("#DivManset"+currentIndex).show();
currentIndex++;
if(currentIndex>12)
{
currentIndex=1;
}
return;
}
}
function StopSliderTimer()
{
clearTimeout(sliderTimerID);
} 

function getYhManset(Mid)
{
$("#AltMansetImg").attr("src",LeadImage[Mid-1]);
$("#AltMansetLink").attr("href",LeadLinks[Mid-1]);
var elem="#BesliMansetLink"+Mid;	
$(elem).attr("href", LeadLinks[Mid-1]);
$("#AltMansetTitle a").text(LeadTitle[Mid-1]);
$("#AltMansetTitle a").attr("href", LeadLinks[Mid-1]);
$("#AltMansetSpot a").text(LeadSpot[Mid-1]);
$("#AltMansetSpot a").attr("href", LeadLinks[Mid-1]);
}
function getLinks()
{
$("#AltMansetImg").attr("src",LeadImage[0]);
$("#AltMansetLink").attr("href",LeadLinks[0]);		
$("#BesliMansetLink1").attr("href", LeadLinks[0]);
$("#AltMansetTitle a").text(LeadTitle[0]);
$("#AltMansetSpot a").text(LeadSpot[0]);
$("#AltMansetTitle a").attr("href", LeadLinks[0]);
$("#AltMansetSpot a").attr("href", LeadLinks[0]);
}		

function PromoAileGoster(id)
{
for (var i=1;i<=3;i++)
{
if (i!=id)
{
$("#div"+i).css("display","none");
$("#divAileBaslik"+i).removeClass('PromoMenuAileFL2').addClass('PromoMenuAileFL');
$("#proAileLink"+i).removeClass('PromoAileLinkStyle2').addClass('PromoAileLinkStyle1');
}
else
{
$("#div"+i).css("display","block");
$("#divAileBaslik"+i).removeClass('PromoMenuAileFL').addClass('PromoMenuAileFL2');
$("#proAileLink"+i).removeClass('PromoAileLinkStyle1').addClass('PromoAileLinkStyle2');
}
}
}
function PromoGoster(id)
{for (var i=1;i<=6;i++)  {
if (i!=id){
$("#divPro"+i).css("display","none");
$("#divProBaslik"+i).removeClass('PromoMenuFL2 FL').addClass('PromoMenuFL FL');
$("#proLink"+i).removeClass('PromoLinkStyle2').addClass('PromoLinkStyle1');
}
else
{
$("#divPro"+i).css("display","block");
$("#divProBaslik"+i).removeClass('PromoMenuFL FL').addClass('PromoMenuFL2 FL');
$("#proLink"+i).removeClass('PromoLinkStyle1').addClass('PromoLinkStyle2');
}
}
}
function PromoRandomGoster()
{
var randomValue=Math.floor(Math.random()*6);
if(randomValue == 0)
{
randomValue=1;
}
PromoGoster(randomValue);
}
function EklerGoster()
{          
document.location.href= document.getElementById("eklerid").value;              
}
function IslerGoster()
{          
document.location.href= document.getElementById("eisid").value;                
}
function MansetGoster(id)
{
for (var i=1;i<=12;i++)
{
if (i!=id)
{
$("#DivManset"+i).css("display","none");
}
else
{
$("#DivManset"+i).css("display","block");
}
}
}
/*
function KucukMansetGoster(id)
{
for (var i=1;i<=5;i++)
{
if (i!=id)
{
$("#DivKucukManset"+i).css("display","none");
}
else
{
$("#DivKucukManset"+i).css("display","block");
}
}
}
*/

function setCookie(c_name,value,exdays)
{
var exdate=new Date();
exdate.setDate(exdate.getDate() + exdays);
var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
document.cookie=c_name + "=" + c_value;
window.location.reload();
}

function reArrange(kelime)
{
return(kelime.replace(/ü/g, "%C3%BC").replace(/Ü/g, "%C3%9C").replace(/þ/g, "%C5%9F").replace(/Þ/g, "%C5%9E").replace(/ð/g, "%C4%9F").replace(/Ð/g, "%C4%9E").replace(/ç/g, "%C3%A7").replace(/Ç/g, "%C3%87").replace(/ý/g, "%C4%B1").replace(/Ý/g, "%C4%B0").replace(/ö/g, "%C3%B6").replace(/Ö/g, "%C3%96").replace(/ /g, "%20"));
}
$("#keyword2").ready(function(){
 $("#aramaForm").submit(function() {
 $('#keyword').val(reArrange($('#keyword2').val()));
 if($("#keyword2").val()=="Aranacak Kelime" || $("#keyword2").val()=="Aranacak Kelime Giriniz!" || $("#keyword2").val()=="")
 {
 $("#keyword2").val("Aranacak Kelime Giriniz!");
 return false;
 }
 });
$("#keyword2").click(function() {
if($("#keyword2").val()=="Aranacak Kelime" || $("#keyword2").val()=="Aranacak Kelime Giriniz!")
{  
$("#keyword2").val("");
}
});
$("#keyword2").blur(function() {
if($("#keyword2").val()=="")
$("#keyword2").val("Aranacak Kelime");
});
});
