/******************************************************************************
* Utility.js                                                                  *
*                                                                             *
* Atilla Koç                                                                  *
******************************************************************************/
timerID = null;
var active = 0;

function ScrollUp(speed) {
    if (document.getElementById) {
        if (parseInt(obj[active].style.top) < 0) {
            obj[active].style.top = parseInt(obj[active].style.top) + speed + "px";
        }
        timerID = setTimeout("ScrollUp(" + speed + ")", 30);
    }
}

function ScrollDown(speed) {
    if (document.getElementById) {
        if (parseInt(obj[active].style.top) > document.getElementById('cont').offsetHeight - obj[active].offsetHeight) {
            obj[active].style.top = parseInt(obj[active].style.top) - speed + "px";
        }
        timerID = setTimeout("ScrollDown(" + speed + ")", 30);
    }
}

function ScrollStop() {
    if (document.getElementById) {
        clearTimeout(timerID);
    }
}

function ScrollPageInit() {
    if (document.getElementById) {
        obj = document.getElementById("cont").getElementsByTagName("div");
        obj['page1'].style.visibility = "visible";
        obj['page1'].style.top = 0;
    }
    if (document.addEventListener) {
        for (i = 0; i < document.getElementsByTagName('a').length; i++) {
            document.getElementsByTagName('a')[i].style.position = "relative";
        }
    }
}
function pencere(type,u)
{
	//document.location="/Mecra_Detay.asp?MID=" + u;
	var x = 'YAYIN';
	var param;
	param='';
	param=param+'directories=no';
	param=param+', location=no';
	param=param+', menubar=no';
	param=param+', resizable=no';
	param=param+', statusbar=no';
	param=param+', toolbar=no';
	param=param+', scrollbars=no';
	param=param+', left=0';
	param=param+', top=0';
	param=param+', width=480';

	if (type=='dinle')
	{
		u = 'radyo_dinle.aspx?MID='+u;
		param=param+', height=206';
	}
	else if (type=='izle')
	{
		u = 'tv_izle.aspx?MID='+u;
		param=param+', height=206';
	}else if (type=='f_izle')
	{
	    u = 'Tv_izle_flash.aspx?MID='+u;
	    param=param+', height=550';
	}else if (type=='f_dinle')
	{
	    u = 'Tv_izle_flash.aspx?MID='+u;
	    param=param+', height=206';
	}


	window.open(u,x,param);
}

function SwapImage(ButonNo, DurumNo) {
	var durum = Array('of', 'on', 'over');
	var buton = Array('stop', 'pause', 'play', 'mute', 'VolDown', 'VolUp');
	var isim;
	isim = eval("document.button_" + buton[ButonNo] + ".src");
	if (isim.substring(isim.length - 6, isim.length - 4) == 'on') {return;}
	eval("document.button_" + buton[ButonNo] + ".src = 'Images/" + buton[ButonNo] + "_" + durum[DurumNo] + ".gif';");
	if (DurumNo==1) {
		for (i=0;i<=2;i++) {
			if (i != ButonNo) {
				eval("document.button_" + buton[i] + ".src = 'Images/" + buton[i] + "_of.gif';");
			}
		}
	}
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

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 RadyoDegistir()
{
	var indis=document.AnaForm.Mecra_Id.selectedIndex;
	var RadyoID=document.AnaForm.Mecra_Id.options[indis].value;
	/*if (RadyoID!="") {
		pencere('dinle',RadyoID);
		window.close();
	}*/
	document.AnaForm.action="live.asp?MID=" + RadyoID;
	document.AnaForm.submit();
}

function TVDegistir()
{
	var indis=document.AnaForm.Mecra_Id.selectedIndex;
	var TVID=document.AnaForm.Mecra_Id.options[indis].value;
	/*if (RadyoID!="") {
		pencere('izle',TVID);
		window.close();
	}*/
	document.AnaForm.action="liveTV.asp?MID=" + TVID;
	document.AnaForm.submit()
}

function nocontextmenu()
{
	event.cancelBubble = true;
	event.returnValue = false;
	return false;
}

function norightclick(e)
{
	if (window.Event)
	{
		if (e.which == 2 || e.which == 3)
		return false;
	}
	else if (event.button == 2 || event.button == 3)
	{
		event.cancelBubble = true;
		event.returnValue = false;
		return false;
	}
}

function FlashYaz(id,w,h,source, wm, bgc, fvar, StartTag, EndTag)
{
	if (wm=='t') wmode='transparent';
	else wmode='opaque';
	
	document.writeln(StartTag);
	document.writeln('<object width="'+w+'" height="'+h+'" id="'+id+'" align="middle" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">');
	document.writeln('<param name="movie" value="'+source+'" />');
	document.writeln('<param name="bgcolor" value="'+bgc+'" />');
	document.writeln('<param name="wmode" value="'+wmode+'" />');
	document.writeln('<param name="FlashVars" value="'+fvar+'" />');
	document.writeln('<param name="allowScriptAccess" value="sameDomain" />');
	document.writeln('<param name="quality" value="high" />');
	document.writeln('<embed name="'+id+'" src="'+source+'" quality="high" flashvars="'+fvar+'" wmode="'+wmode+'" bgcolor="'+bgc+'" width="'+w+'" height="'+h+'" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.writeln('</object>');
	document.writeln(EndTag);
}

function objeBul(bunu) {
  var theObject = document.getElementById(bunu);
  if (document.getElementById) {
    /* Internet Explorer, Opera */
    theObject = document.getElementById(bunu);
  } else if (document.layers) {
    /* Mozilla */
    theObject = document.layers[bunu];
  } else if (document.all) {
    /* Netscape? */
    theObject = document.all(bunu);
  };

  return theObject;
}



