function flashgoster(dosya,en,boy,deger){
document.writeln("<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='https://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' WIDTH='"+en+"' HEIGHT='"+boy+"' id='contents' ALIGN=''>");
document.writeln("<PARAM NAME=movie value='"+dosya+"' />");
document.writeln("<PARAM NAME=quality VALUE=high>");
document.writeln("<PARAM NAME=wmode VALUE=transparent>");
document.writeln("<PARAM NAME=flashvars id=objflashvars VALUE=deger="+deger+">");	
document.writeln("<EMBED src='"+dosya+"' quality='high' bgcolor='#ffffff' width='"+en+"' height='"+boy+"' name='contents' align='middle' allowScriptAccess='sameDomain'wmode='transparent' type='application/x-shockwave-flash' pluginspage='https://www.macromedia.com/go/getflashplayer' flashvars='deger="+deger+"' />");
document.writeln("</OBJECT>");
}



function openWin(strURL, arg1, arg2, arg3)
{

        intX = arg2;
        intY = arg3;
		oWin = window.open (strURL, arg1, "toolbar=no, menubar=no, location=no, status=no, width=" + arg2 + ", height=" + arg3 + ",left=0, top=0, scrollbars=yes, resizable=yes");
		oWin.focus();
}






      var prevVisible = 'none'; 
      var nextVisible = 'none';
 
  
      function PrintArticle(id,tip)
      {
      var amp = "&";
      window.open("http://www.haber24.com/Yazdir/"+ tip + "/" + id,null,"height=650,width=800,titlebar=no,status=no,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=1");
      }


      function SwitchUL(ul1,img1,down)
      {
      if(document.getElementById(ul1).style.display=='none')
      {
      document.getElementById(ul1).style.display='';
      document.getElementById(img1).src =document.getElementById(img1).src.replace('down','up');
      }
      else
      {
      document.getElementById(ul1).style.display='none';
      document.getElementById(img1).src =document.getElementById(img1).src.replace('up','down');
      }
      }












/**
 * Hava Durumu İşlemleri
 */

$(function(){
	hdYukle();
	$('#hdlist').change(function(){
		if (this.value == 0) {return false};
		hdYukle(this.value);
	});
	
});


var hdData     = '';
var hdSehirler = '';

function hdYukle($sehirAnahtar) {

    if($sehirAnahtar==undefined){
        $sehirAnahtar=getCookie('HD_SehirAnahtar');
    }
	
    if($sehirAnahtar==''){
        $sehirAnahtar='istanbul';
    }
	
	$('#topWeather').addClass('loading');
    $('#weatherCities').hide();
    
    data=getCookie('HD_Data');

    if(data!='' && data.sehiranahtar!=$sehirAnahtar){
        data='';
        
    }

    if(data==''){
        
    	$.getJSON('jscss/havadurumu_json.php?sehir='+$sehirAnahtar, function(data) {
    	    hdData = data;	    
            setCookie('HD_SehirAnahtar',$sehirAnahtar,365);
            hdDuznle($sehirAnahtar);
           
    	});
    }else{
        hdData = $.JSON.decode(data);
        hdDuznle($sehirAnahtar);
    }
    

}


function hdDuznle() {
	//console.log(hdData);
    

    /*
    var infoo = hdData.info;
    infoo = infoo.substr(0,13);
    $('#hdimg').attr('src', hdData.img);
    $('#topWeather .sicaklik').html( hdData.sehir+' '+hdData.derece+' <b>'+infoo+'</b>' );
    */

    $('#hvCity').html(hdData.sehir);
    
    for(syc=0;syc<5;syc++){ 
    $('#hvMood_'+syc).html(hdData.besgun.durum[syc]);
    $('#hdimg_'+syc).attr('src','http://services.nette.com.tr/v2/services/hava/images/'+hdData.besgun.image[syc]+'.gif');
    $('#hvDeg1_'+syc).html(hdData.besgun.sicaklik[syc]);
    $('#hvDeg2_'+syc).html(hdData.besgun.sicaklik2[syc]);
    $('#hvday_'+syc).html(hdData.besgun.gun[syc]);
    }
    
}



















function modal_ac_div(divid,width,height){
	$.fx.speeds._default = 1000;
	$(function() {
		$( "#"+divid ).dialog({
			autoOpen: false,
			show: "blind",
			hide: "explode",
            width: width,
            height: height
		});
			$( "#"+divid ).dialog( "open" );
			return false;
	});
}
function modal_ac(adres,baslik,w,h){
            var randomnumber=Math.floor(Math.random()*11)
			var $this = $(this);
			var horizontalPadding = 0;
			var verticalPadding = 5;
	        $('<iframe id="externalSite'+randomnumber+'" class="externalSite" src="' + adres + '" frameborder="0" />').dialog({
	            title: baslik,
                stack: false,
	            autoOpen: true,
	            width: w,
	            height: h,
	            modal: true,
	            resizable: false,
				autoResize: false,
	            overlay: {
	                opacity: 0.5,
	                background: "black"
	            }                
	        }).width(w - horizontalPadding).height(h - verticalPadding);
}











var requiredMajorVersion = 9;
var requiredMinorVersion = 0;
var requiredRevision = 28;

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
  var i,img,nbArr,args=MM_nbGroup.arguments;
  if (event == "init" && args.length > 2) {
    if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
      img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
      if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
      nbArr[nbArr.length] = img;
      for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
        if (!img.MM_up) img.MM_up = img.src;
        img.src = img.MM_dn = args[i+1];
        nbArr[nbArr.length] = img;
    } }
  } else if (event == "over") {
    document.MM_nbOver = nbArr = new Array();
    for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
      nbArr[nbArr.length] = img;
    }
  } else if (event == "out" ) {
    for (i=0; i < document.MM_nbOver.length; i++) {
      img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
  } else if (event == "down") {
    nbArr = document[grpName];
    if (nbArr)
      for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
    document[grpName] = nbArr = new Array();
    for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
      if (!img.MM_up) img.MM_up = img.src;
      img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
      nbArr[nbArr.length] = img;
  } }
}





var aktifResim = null;

function initBolgeResim(src){
    aktifResim = src;
}

function highlight(bolge){
    document.getElementById("bolgeler").src = "images/" + bolge.getAttribute("resim");
}

function bolgeout(){
    document.getElementById("bolgeler").src = "images/bolgeler.jpg";
}



function pausescroller(content, divId, divClass, delay){
this.content=content //message array content
this.tickerid=divId //ID of ticker div to display information
this.delay=4000 //Delay between msg change, in miliseconds.
this.mouseoverBol=0 //Boolean to indicate whether mouse is currently over scroller (and pause it if it is)
this.hiddendivpointer=1 //index of message array for hidden div
document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')
var scrollerinstance=this
if (window.addEventListener) //run onload in DOM2 browsers
window.addEventListener("load", function(){scrollerinstance.initialize()}, false)
else if (window.attachEvent) //run onload in IE5.5+
window.attachEvent("onload", function(){scrollerinstance.initialize()})
else if (document.getElementById) //if legacy DOM browsers, just start scroller after 0.5 sec
setTimeout(function(){scrollerinstance.initialize()}, 500)
}

// -------------------------------------------------------------------
// initialize()- Initialize scroller method.
// -Get div objects, set initial positions, start up down animation
// -------------------------------------------------------------------

pausescroller.prototype.initialize=function(){
this.tickerdiv=document.getElementById(this.tickerid)
this.visiblediv=document.getElementById(this.tickerid+"1")
this.hiddendiv=document.getElementById(this.tickerid+"2")
this.visibledivtop=parseInt(pausescroller.getCSSpadding(this.tickerdiv))
//set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"
this.getinline(this.visiblediv, this.hiddendiv)
this.hiddendiv.style.visibility="visible"
var scrollerinstance=this
document.getElementById(this.tickerid).onmouseover=function(){scrollerinstance.mouseoverBol=1}
document.getElementById(this.tickerid).onmouseout=function(){scrollerinstance.mouseoverBol=0}
if (window.attachEvent) //Clean up loose references in IE
window.attachEvent("onunload", function(){scrollerinstance.tickerdiv.onmouseover=scrollerinstance.tickerdiv.onmouseout=null})
setTimeout(function(){scrollerinstance.animateup()}, this.delay)
}


// -------------------------------------------------------------------
// animateup()- Move the two inner divs of the scroller up and in sync
// -------------------------------------------------------------------

pausescroller.prototype.animateup=function(){
var scrollerinstance=this
if (parseInt(this.hiddendiv.style.top)>(this.visibledivtop+5)){
this.visiblediv.style.top=parseInt(this.visiblediv.style.top)-5+"px"
this.hiddendiv.style.top=parseInt(this.hiddendiv.style.top)-5+"px"
setTimeout(function(){scrollerinstance.animateup()}, 50)
}
else{
this.getinline(this.hiddendiv, this.visiblediv)
this.swapdivs()
setTimeout(function(){scrollerinstance.setmessage()}, this.delay)
}
}

// -------------------------------------------------------------------
// swapdivs()- Swap between which is the visible and which is the hidden div
// -------------------------------------------------------------------

pausescroller.prototype.swapdivs=function(){
var tempcontainer=this.visiblediv
this.visiblediv=this.hiddendiv
this.hiddendiv=tempcontainer
}

pausescroller.prototype.getinline=function(div1, div2){
div1.style.top=this.visibledivtop+"px"
div2.style.top=Math.max(div1.parentNode.offsetHeight, div1.offsetHeight)+"px"
}

// -------------------------------------------------------------------
// setmessage()- Populate the hidden div with the next message before it's visible
// -------------------------------------------------------------------

pausescroller.prototype.setmessage=function(){
var scrollerinstance=this
if (this.mouseoverBol==1) //if mouse is currently over scoller, do nothing (pause it)
setTimeout(function(){scrollerinstance.setmessage()}, 100)
else{
var i=this.hiddendivpointer
var ceiling=this.content.length
this.hiddendivpointer=(i+1>ceiling-1)? 0 : i+1
this.hiddendiv.innerHTML=this.content[this.hiddendivpointer]
this.animateup()
}
}

pausescroller.getCSSpadding=function(tickerobj){ //get CSS padding value, if any
if (tickerobj.currentStyle)
return tickerobj.currentStyle["paddingTop"]
else if (window.getComputedStyle) //if DOM2
return window.getComputedStyle(tickerobj, "").getPropertyValue("padding-top")
else
return 0
}



function ajaxsayfa(url, divid){
document.getElementById(divid).innerHTML="<div style=\"text-align:center;color:#616161;\"><img src=\"images/spinner.gif\"></div>"
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
} 
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, divid)
}
page_request.open('GET', url, true)
page_request.send(null)
}

function loadpage(page_request, divid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(divid).innerHTML=page_request.responseText
}




var aktifResim = null;

function initBolgeResim(src){
    aktifResim = src;
}

function highlight(bolge){
    document.getElementById("bolgeler").src = "images/" + bolge.getAttribute("resim");
}

function bolgeout(){
    document.getElementById("bolgeler").src = "images/bolgeler.jpg";
}



/*TAB MENÜ SCRIPTI*/  
  
var loadstatustext="<img src='/images/loader.gif' /> Yükleniyor...";
var autocontrolvar;

var arrayList = new Array (  "/tab/", //// Tab 
							"/tab/changeMustWatch", //// Must Watch
							"/tab/changeMustRead", //// Must Read
							"/tab/"

						 ); 	

function changeNavigation ( arg, total_arg, tab_name )
{	
   try 
   {   		

	 		
	if ( tab_name == 'most' || tab_name == 'cokizlenengenel') 		
    {	 
	 for ( var i=1; i <= total_arg ; i++ )	 {
		if ( arg == i )
			document.getElementById( tab_name +i).style.display="block";
		else
			document.getElementById( tab_name +i).style.display="none";
	}
	
	if (tab_name == 'most' || tab_name == 'cokizlenengenel') 
    {
				for ( var i=1; i <= total_arg ; i++ )	 {
				if ( arg == i )
					document.getElementById( "a" + tab_name +i).style.display="block";
				else
					document.getElementById( "a" + tab_name +i).style.display="none";
			}
			}		
		}
		http.send(null);
   }catch(e){}
}
/*TAB MENÜ SCRIPTI SONU*/ 












/* 
todo: close delay
todo: click button to open

http://www.sohtanaka.com/web-design/examples/drop-down-menu/#
http://www.noupe.com/tutorial/drop-down-menu-jquery-css.html
http://css-tricks.com/examples/DiggHeader/#
*/

(function($){
	$.fn.dropmenu = function(custom) {
		var defaults = {
		  	openAnimation: "slide",
			closeAnimation: "slide",
			openClick: false,
			openSpeed: 500,
			closeSpeed: 700,
			closeDelay:500,
			onHide: function(){},
			onHidden: function(){},
			onShow: function(){},
			onShown: function(){}
		  };
		var settings = $.extend({}, defaults, custom);
		
		var menu = this;
		var currentPage = 0;
		var delayTimer = "";
		
		// Trigger init
		init();
		
		/**
		 * Do preparation work
		 */
		function init(){

			// Add open button and class to parent of a submenu
			var items = menu.find(":has(li,div) > a").append('<span class="arrow"></span>');
			$.each(items, function(i, val) {
				if(items.eq(i).parent().is("li")){
					items.eq(i).next().addClass("submenu").parent().addClass("haschildren");
				}else{
					items.eq(i).parent().find("ul").show();
				}
			});
			
			if(settings.openClick){
				menu.find(".submenu").css("display", "none");
				menu.find(":has(li,div) > a").parent().bind("mouseleave",handleHover).bind("mouseenter",function(){ window.clearInterval(delayTimer); });
				menu.find("a span.arrow").bind("click", handleHover);
			}else{
				menu.find(":has(li,div) > a").bind("mouseenter",handleHover).parent().bind("mouseleave",handleHover).bind("mouseenter",function(){ window.clearInterval(delayTimer); });
			}
			
			
		}
		
		/**
		 * Handle mouse hover action
		 */
		function handleHover(e){
			if(e.type == "mouseenter" || e.type == "click"){
				window.clearInterval(delayTimer);
				var current_submenu = $(e.target).parent().find(".submenu:not(:animated):not(.open)");
				if(current_submenu.html() == null){
					current_submenu = $(e.target).parent().next(".submenu:not(:animated):not(.open)");
				}
				if(current_submenu.html() != null){
					settings.onShow.call(current_submenu);
					closeAllMenus();
					current_submenu.prev().addClass("selected");
					current_submenu.css("z-index", "90");
					current_submenu.stop().hide();
					openMenu(current_submenu);
				}
			}
			if(e.type == "mouseleave" || e.type == "mouseout"){
				current_submenu = $(e.target).parents(".submenu");
				if(current_submenu.length != 1){
					var current_submenu = $(e.target).parent().parent().find(".submenu");
					if(current_submenu.html() == null){
						var current_submenu = $(e.target).parent().find(".submenu");
						if(current_submenu.html() == null){
							var current_submenu = $(e.target).parent().parent().parent().find(".submenu");
						}
					}
				}
				if(current_submenu.html() != null){
					if(settings.closeDelay == 0){
						current_submenu.parent().find("a").removeClass("selected");
						closeMenu(current_submenu);
					}else{
						window.clearInterval(delayTimer);
						delayTimer = setInterval(function(){
							window.clearInterval(delayTimer);
							closeMenu(current_submenu);
						}, settings.closeDelay);	
					}
				}
			}
		}
		
		function openMenu(object){
			switch(settings.openAnimation){
				case "slide":
					openSlideAnimation(object);
					break;
				case "fade":
					openFadeAnimation(object);
					break;
				default:
					openSizeAnimation(object);
					break;
			}
		}
		
		function openSlideAnimation(object){
			object.addClass("open").slideDown(settings.openSpeed, function(){ settings.onShown.call(this); });
		}
		
		function openFadeAnimation(object){
			object.addClass("open").fadeIn(settings.openSpeed, function(){ settings.onShown.call(this); });
		}
		
		function openSizeAnimation(object){
			object.addClass("open").show(settings.openSpeed, function(){ settings.onShown.call(this); });
		}
		
		function closeMenu(object){
			settings.onHide.call(object);
			switch(settings.closeAnimation){
				case "slide":
					closeSlideAnimation(object);
					break;
				case "fade":
					closeFadeAnimation(object);
					break;
				default:
					closeSizeAnimation(object);
					break;
			}
		}
		
		function closeSlideAnimation(object){
			object.slideUp(settings.closeSpeed, closeCallback);
		}
		
		function closeFadeAnimation(object){
			object.fadeOut(settings.closeSpeed, function(){ $(this).removeClass("open"); $(this).prev().removeClass("selected"); });
		}
		
		function closeSizeAnimation(object){
			object.hide(settings.closeSpeed, function(){ $(this).removeClass("open"); $(this).prev().removeClass("selected"); });
		}
		
		function closeAllMenus(){
			var submenus = menu.find(".submenu.open");
			$.each(submenus, function(i, val) {
				$(submenus[i]).css("z-index", "1");
				closeMenu($(submenus[i]));
			});
		}
		
		function closeCallback(object){
			$(this).removeClass("open"); 
			if($(this).prev().attr("class") == "selected") settings.onHidden.call(this);
			$(this).prev().removeClass("selected");
		}
			
		// returns the jQuery object to allow for chainability.
		return this;
	}
	
})(jQuery);



