﻿var xmlhttp
var xmlBoxeshttp
var xmlhttpCount
var xmlBNlist

function loadXMLDoc(url1,url2,url3,url4)
{
//alert("Hi");
xmlhttp=null
xmlBoxeshttp=null
xmlhttpCount=0
xmlMARQUEE=null;
xmlBNlist =null;
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  
  xmlhttp=new XMLHttpRequest()
  xmlBoxeshttp=new XMLHttpRequest()
  xmlMARQUEE=new XMLHttpRequest()
  xmlBNlist =new XMLHttpRequest()
 // if(xmlhttp==null)
//  alert("okkddd");
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  xmlBoxeshttp=new ActiveXObject("Microsoft.XMLHTTP")
  xmlMARQUEE=new ActiveXObject("Microsoft.XMLHTTP")
  xmlBNlist = new ActiveXObject("Microsoft.XMLHTTP")
  
  }
if (xmlhttp!=null && url1!='')
  {
  //alert(url1);
  xmlhttp.onreadystatechange=state_Change
  xmlhttp.open("GET",url1,true)
  xmlhttp.send(null)
  }
else
  {
 
  }
  if (xmlBoxeshttp!=null && url2!='')
  {
  xmlBoxeshttp.onreadystatechange=state_Change2
  xmlBoxeshttp.open("GET",url2,true)
  xmlBoxeshttp.send(null)
  }
else
  {
  
  }
  if (xmlMARQUEE!=null && url3!='')
  {
  xmlMARQUEE.onreadystatechange=state_Change3
  xmlMARQUEE.open("GET",url3,true)
  xmlMARQUEE.send(null)
  }
else
  {
  
  }
  
  if (xmlBNlist!=null && url4!='')
  {
  xmlBNlist.onreadystatechange=state_Change7
  xmlBNlist.open("GET",url4,true)
  xmlBNlist.send(null)
  }
else
  {
  
  }
  
}

function state_Change()
{
  
// if xmlhttp shows "loaded"
if (xmlhttp.readyState==4)
  {
  // if "OK"
 
  }
}
function state_Change2()
{
 
// if xmlhttp shows "loaded"
if (xmlBoxeshttp.readyState==4)
  {
  // if "OK"
  
  }
}

function state_Change7()
{
 
// if xmlhttp shows "loaded"
if (xmlBNlist.readyState==4)
  {
  // if "OK"
  
  }
}

function state_Change3()
{
 
// if xmlhttp shows "loaded"
if (xmlMARQUEE.readyState==4)
  {
  // if "OK"
  
  }
}


function showMe(type,id)
{
  
   if(type=='0')
   this.T_WIDTH=0;
   else
   this.T_WIDTH=0;
   
  var xid = id.replace("table_","");   
   var yid = parseInt(xid);
   
   if(type == 'S')
   {
   if(xmlBoxeshttp !=null)
  {
   var xmlDoc = xmlBoxeshttp.responseXML;
   var x= xmlDoc.getElementsByTagName('html');
   
   
   //alert("***"+yid);
   return x[yid].childNodes[0].nodeValue;
  }
   }
   else if(type== 'H')
   {
   if(xmlhttp !=null)
  {
   var xmlDoc = xmlhttp.responseXML;
   var x= xmlDoc.getElementsByTagName('html');
   
   return x[yid].childNodes[0].nodeValue;
  }
   }
   
    else if(type== 'B')
   {
   if(xmlBNlist !=null)
  {
   var xmlDoc = xmlBNlist.responseXML;
   var x= xmlDoc.getElementsByTagName('html');
   return x[yid].childNodes[0].nodeValue;
  }
   }
   
    else if(type== 'M')
   {
   if(xmlMARQUEE !=null)
  {
   var xmlDoc = xmlMARQUEE.responseXML;
   var x= xmlDoc.getElementsByTagName('html');
   
   return x[yid].childNodes[0].nodeValue;
  }
   }
   
   
   
  return id;
  
}

function xxx()
{
   var obj = document.getElementById("B6");
   if(obj.title =='')
   document.getElementById("B6").title="header=[<br><br><a href='www.yahoo.com'>anas</a>] body=[body text]";
  
   
}
//***************************
var xmlVideohttp;
var id=-1;
function loadVideoXML(url)
{
//var urls = window.location.href;
//var index =  urls.indexOf("?");

//if(index > 0)
//{
//var sid =  urls.substring(index+1);
//id = parseInt(sid);
//}
xmlVideohttp=null
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlVideohttp=new XMLHttpRequest()
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlVideohttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
if (xmlVideohttp!=null)
  {
  xmlVideohttp.onreadystatechange=state_Change4
  xmlVideohttp.open("GET",url,true)
  xmlVideohttp.send(null)
  }
else
  {
  alert("Your browser does not support XMLHTTP.")
  }
}

function state_Change4()
{
// if xmlhttp shows "loaded"
if (xmlVideohttp.readyState==4)
  {
  // if "OK"
  if (xmlVideohttp.status==200)
  {

 var urls = window.location.href;
 var index =  urls.indexOf("?vid");

if(index > 0)
{
var sid =  urls.substring(index+1);
id = parseInt(sid);
showVideo(id);
}

//  document.getElementById('A1').innerHTML=xmlhttp.status
//  document.getElementById('A2').innerHTML=xmlhttp.statusText
//  document.getElementById('A3').innerHTML=xmlhttp.responseText
 
  }
  else
  {
	//alert("Problem retrieving XML data:" + xmlhttp.statusText)
	window.status = "Problem retrieving XML data:" + xmlhttp.statusText;
  }
  }
  
}


function showVideo(id)
{

  if(id<0)
  return;
 xmlVideohttp=null
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlVideohttp=new XMLHttpRequest()
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlVideohttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
if (xmlVideohttp!=null)
  {window.scrollTo(0,0);
  xmlVideohttp.onreadystatechange=state_Change4
  xmlVideohttp.open("GET",'Content/Videos/_'+id+'.xml',true)
  xmlVideohttp.send(null)
  }
else
  {
  alert("Your browser does not support XMLHTTP.")
  }
}





function state_Change4()
{
// if xmlhttp shows "loaded"
if (xmlVideohttp.readyState==4)
  {
  // if "OK"
  if (xmlVideohttp.status==200)
  {

 


//***********************************************************************
 // document.getElementById('VideoViewDiv').innerHTML = "<br/><IMG src='Images/Loading.gif' />";
  document.getElementById('VideoViewDiv').style.visibility = "visible";
  document.getElementById('VideoViewDiv').style.display = "block";
    
 if(xmlVideohttp !=null)  {
   
   var xmlDoc = xmlVideohttp.responseXML;
   var x= xmlDoc.getElementsByTagName('Video');
   var count = x.length;
   var x = xmlDoc.getElementsByTagName('id');
   var x= xmlDoc.getElementsByTagName('videoCode');
  
  document.getElementById('VideoViewDiv').innerHTML = x[0].childNodes[0].nodeValue;
   var ele = document.getElementById('VideoViewDiv');
    }
   //************************************************************


//  document.getElementById('A1').innerHTML=xmlhttp.status
//  document.getElementById('A2').innerHTML=xmlhttp.statusText
//  document.getElementById('A3').innerHTML=xmlhttp.responseText
 
  }
  else
  {
	//alert("Problem retrieving XML data:" + xmlhttp.statusText)
	window.status = "Problem retrieving XML data:" + xmlhttp.statusText;
  }
  }
  
}
 
 

  
 

function CloseVideoArea()
{
document.getElementById("video_area").style.visibility = "hidden";
document.getElementById("video_area").style.display = "none";
 document.getElementById('VideoViewDiv').innerHTML = "";


}

function SN_ToolTip(type,tooltipText)
{
 
    return escape(tooltipText);
}



var arr;

function SetMyPageImage(ImgID)
{
fillArray();
checkImg(ImgID);

}

function fillArray()
{
   arr = null;
   var str = readCookie('SN_Cookie');
   if(str!=null)
   {
    arr = str.split("__") ;
   }
  
}

function checkImg(ImgID)
{
 if(ImgID=='')return;
   var i;
   if(arr != null)
   {
   var xxx = document.getElementById(ImgID);
   
   {
 
     var img = xxx;
     if(img.id.indexOf('ImgX')>-1)
     {
     img.src = 'Images/Dig.ico';
	  img.alt = "Add to NEWS SUMMARY page"
     var a = img.id.substr(4);
     var k=0;
 
     for(k=0;k<arr.length;k++)
     {
 
       if(arr[k]==a)
       {
          img.src = 'Images/Rmv.ico';
		  img.alt = "Remove Category from NEWS SUMMARY Page"
       }
     }
   }
   }
   }
}

function newCookie(name,value,ImgID)
{
	  var days = 7;
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();

	var w = readCookie(name);

	if( w == null)
	{
	
	w='';
	}
	else
	{
	   w = w+"__";
	}

	
	if(w.indexOf(value)>-1){
	deleteCookie('SN_Cookie',value,ImgID);}
	else{
	
	document.cookie = name+"="+w+value+expires+"; path=/";
	}
	fillArray();
    checkImg(ImgID);


}

function deleteCookie(name,value,ImgID)
{
	    var days = 7;
    	var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();

	var w = readCookie(name);

	if( w == null)
	{
		w='';
	}

	w =w.replace(value,"");
	w = w.replace("____","__");
	
	document.cookie = name+"="+w+expires+"; path=/";
	fillArray();
checkImg(ImgID);
	
}


function ResetAll()
{
var name = "SN_Cookie";
		var days = 7;
    	var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
         
    	document.cookie = name+"="+""+expires+"; path=/";
}


function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
