var sliderTimerID;
var sliderIndex;
var currentIndex=0;
$(function(){
$(".FlashManset").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"));
}
for (var i=1;i<=5;i++)
{
$('.ImgKManset'+i+'').attr("href", $('#DivKucukManset'+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<=5;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 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(){
$("#keyword2").click(function() {
if($("#keyword2").val()=="Aranacak Kelime" || $("#keyword2").val()=="Aranacak Kelime Giriniz!")
{  
$("#keyword2").val("");
$("#aramaLink").attr("href", "#")}
});
$("#keyword2").blur(function() {
if($("#keyword2").val()=="")
$("#keyword2").val("Aranacak Kelime");
});
$('#keyword2').keyup(function(e) 
{	
var kw=$("#keyword2").val();
$("#aramaLink").attr("href", "http://arama.hurriyet.com.tr/?keyword2="+reArrange(kw)+"&keyword="+reArrange(kw));
$("#aramaLink").attr("title", kw);
$("#keyword").val(reArrange(kw));
}
);
$("#aramaLink").click(function() {
var myHr = 	$("#aramaLink").attr("href");
if(myHr == "#")
{
$("#keyword2").val("Aranacak Kelime Giriniz!");
return false;
}
});
});
