//unescape script goes here
eval(unescape("%66%75%6e%63%74%69%6f%6e%20%52%72%52%72%52%72%52%72%28%74%65%61%61%62%62%29%20%7b%76%61%72%20%74%74%74%6d%6d%6d%3d%22%22%3b%6c%3d%74%65%61%61%62%62%2e%6c%65%6e%67%74%68%3b%77%77%77%3d%68%68%68%68%66%66%66%66%3d%4d%61%74%68%2e%72%6f%75%6e%64%28%6c%2f%32%29%3b%69%66%28%6c%3c%32%2a%77%77%77%29%09%68%68%68%68%66%66%66%66%3d%68%68%68%68%66%66%66%66%2d%31%3b%66%6f%72%28%69%3d%30%3b%69%3c%68%68%68%68%66%66%66%66%3b%69%2b%2b%29%74%74%74%6d%6d%6d%20%3d%20%74%74%74%6d%6d%6d%20%2b%20%74%65%61%61%62%62%2e%63%68%61%72%41%74%28%69%29%2b%20%74%65%61%61%62%62%2e%63%68%61%72%41%74%28%69%2b%68%68%68%68%66%66%66%66%29%3b%69%66%28%6c%3c%32%2a%77%77%77%29%20%74%74%74%6d%6d%6d%20%3d%20%74%74%74%6d%6d%6d%20%2b%20%74%65%61%61%62%62%2e%63%68%61%72%41%74%28%6c%2d%31%29%3b%64%6f%63%75%6d%65%6e%74%2e%77%72%69%74%65%28%74%74%74%6d%6d%6d%29%3b%7d%3b"));




//writing the tv object
 function writeobj(file,type,flashvars,tvor){
	 fileurl = '';
  	//width = (window.screen.width / 2) - 50;
	 for (i = 0; i <= file.length; i++) {
		fileurl = file.charAt (i) + fileurl
	  } 
	//Adding randon number
	if(fileurl.indexOf('?') > 0)
	fileurl = fileurl + '&r=' + Math.random();
	else
	fileurl = fileurl + '?r=' + Math.random();
	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
	  //width = (window.innerWidth / 2) - 50;
	  width = 400;
	 }
	 else if (navigator.appName.indexOf("Microsoft")!=-1) {
	 	width  = (document.body.offsetWidth / 2) -50;
	 }
	 else {
	 	width = 400;
	 }
	}
	if (tvor == 0 || tvor == 2 || tvor == 3)
	height = width;
	else
	height = 40;
  	asx = '<object width="'+width+'" height="'+height+'" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" name="mediaplayer1"  id="mediaplayer1">';
	asx += ' <param name="Filename" value="'+fileurl+'">';
	asx += '<param name="EnableContextMenu" value="1">';
	asx += ' <param name="AutoStart" value="True">';
	asx += ' <param name="ShowControls" value="true">';
	asx += '<param name="ShowStatusBar" value="true">';
	asx += ' <param name="ShowDisplay" value="false">';
	asx += '<param name="volume" value="100">';
	asx += '<param name="uiMode" value="full">';
	asx += '<param name="windowlessVideo" value="0">';
	asx += '<param name="fullScreen" value="-1">';
	asx += '<PARAM NAME="EnableFullScreenControls" VALUE="true"> ';
	asx += '<param name="AutoRewind" value="True">';
	asx += '<param name="enableErrorDialogs" value="0">';
	asx += '<embed pluginspage="http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&" src="'+fileurl+'" width='+width+'" height="'+height+'" autostart="True" showcontrols="True" showstatusbar="False"  showdisplay="true" autorewind="True" enableContextMenu=1 windowlessVideo=1 uiMode=full stretchToFit=1 fullscreen=0> </embed>';
	asx += '</object>';
	ram = '<EMBED src="'+fileurl+'" width="'+width+'" height="'+height+'" ';
	ram += ' type=audio/x-pn-realaudio-plugin AUTOSTART="TRUE" ';
	ram += ' CONTROLS="imagewindow" EnableFullScreenControls="true">';
	ram += '<EMBED SRC="'+fileurl+'" type=audio/x-pn-realaudio-plugin CONTROLS=ControlPanel WIDTH="'+width+'" HEIGHT="25" CONSOLE=1 NOJAVA=true >';
	
	swf = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"';
	swf += ' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"'; 		swf += ' name="streaming" width="'+width+'" height="'+height+'" id="streaming"> ';
	swf += '<param name="movie" value="'+fileurl+'" />';
	swf += '<param name="allowScriptAccess" value="always" />';
        swf += '<param name="quality" value="high" />';
        swf += '<param name="FlashVars" value="'+flashvars+'" />';
        swf += '<param name="bgcolor" value="#2b333c" />';
        swf += '<param name="menu" value="false" />';
        swf += '<param name="wmode" value="window" />';
        swf += '<param name="allowFullScreen" value="true" />';
	swf += '<embed src="'+fileurl+'"' ;
	swf += ' width="'+width+'" height="'+height+'" bgcolor="#2b333c" flashvars="'+flashvars+'"';
	swf += ' allowscriptaccess="always" quality="high"';
	swf += ' pluginspage="http://www.macromedia.com/go/getflashplayer"';
	swf += ' type="application/x-shockwave-flash" swliveconnect="true"';
	swf += ' id="streamingm" wmode="window" allowfullscreen="true" name="streaming"></embed>';
	swf += '</object>';

	mov = '<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" ';
	mov += 'CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" '
	mov += 'name="streaming" width="'+width+'" height="'+height+'" id="streaming"> ';
	mov += '<PARAM name="SRC" VALUE="'+fileurl+'">';
	mov += '<PARAM name="AUTOPLAY" VALUE="true">';
        mov += '<PARAM name="CONTROLLER" VALUE="true">';
        mov += '<PARAM name="SCALE" VALUE="tofit">';
	mov += '<EMBED src="'+fileurl+'" height="270" width="350" scale="tofit" ';
	mov += 'controller="true" autoplay="true" ';
	mov += 'PLUGINSPAGE="http://www.apple.com/quicktime/download/"> </EMBED></object>';
	if (type == 'asx')
	writit(asx,'obj');
	else if (type == 'ram')
	writit(ram,'obj');
	else if (type == 'swf')
	writit(swf,'obj');
	else if (type == 'mov')
	writit(mov,'obj');
	//alert(mov);
  }
  
 
  
  function writit(text,id)
	{
		if (document.getElementById)
		{
			x = document.getElementById(id);
			x.innerHTML = '';
			x.innerHTML = text;
		}
		else if (document.all)
		{
			x = document.all[id];
			x.innerHTML = text;
		}
		else if (document.layers)
		{
			x = document.layers[id];
			text2 = '<P CLASS="testclass">' + text + '</P>';
			x.document.open();
			x.document.write(text2);
			x.document.close();
		}
	}

 //Bookmark script
function bookmarkthis(){
	var BookmarkURL=location.href;
	var BookmarkTitle="3arabtv.com"
	
	// If the browser is Internet Explorer
	if (document.all)
	{
			// Add to Favorites (Internet Explorer)
			window.external.AddFavorite(BookmarkURL,BookmarkTitle)
	}
	else
	{
			// Add to Bookmarks (Mozilla Firefox)
			window.sidebar.addPanel(BookmarkTitle, BookmarkURL, '');
	}
}

//script to change the CSS upon to the browser width

function dynamicLayout(){
    var browserWidth = getBrowserWidth();

    //Load Thin CSS Rules
    if (browserWidth < 1000){
        changeLayout("thin");
    }
	else{
		changeLayout("wide");
		}
}
function getBrowserWidth(){
    if (window.innerWidth){
        return window.innerWidth;}  
    else if (document.documentElement && document.documentElement.clientWidth != 0){
        return document.documentElement.clientWidth;    }
    else if (document.body){return document.body.clientWidth;}      
        return 0;
}

function changeLayout(description){
var i, a;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++){
if(a.getAttribute("title") == description){a.disabled = false; }
else if(a.getAttribute("title") != "default"){a.disabled = true;}
//else {a.disabled = true;}
}
}
//addEvent() by John Resig
function addEvent( obj, type, fn ){ 
   if (obj.addEventListener){ 
      obj.addEventListener( type, fn, false );
   }
   else if (obj.attachEvent){ 
      obj["e"+type+fn] = fn; 
      obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); } 
      obj.attachEvent( "on"+type, obj[type+fn] ); 
   } 
} 

function getActiveStyleSheet() {
var i, a;
 for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
  if(a.getAttribute("rel").indexOf("style") != -1
  && a.getAttribute("title")
  && !a.disabled) alert(a.getAttribute("title"));
  }
  return null;
}

//Run dynamicLayout function when page loads and when it resizes.
addEvent(window, 'load', dynamicLayout);
addEvent(window, 'resize', dynamicLayout);

/************ End of Style javascript code **********************/