// JavaScript Document
//get domain(root_url) code here//
//var domain="http://www.mcsquare.me/";

    var url = document.location.toString() ; //url
	var e_url = '' ; //edited url
	var p = 0 ; //position
	var p2 = 0 ;//position 2
	p = url.indexOf("//") ;
	e_url = url.substring(p+2) ;
	p2 = e_url.indexOf("/") ;
	var domain = url.substring(0,p+p2+3);
//alert(domain);
// Menu js Starts Here //
function ChangeMenu(Id)

{           // alert(Id);
    		var ocells = document.getElementById('atable').getElementsByTagName('td');
			var iCells = ocells.length;

       		for (i=0;i<iCells;i++)
    		{  var cellId=ocells[i].id;
				if(cellId!=Id)
       			{ocells[i].className='td1';
				ocells[i].style.backgroundColor='White';
				//document.getElementById("txtHint").innerHTML="";
				}
				else
				{ocells[i].className='td';
				ocells[i].style.backgroundColor='#E4E4E4';
				}
			}
			 document.getElementById(Id).className='td';
             document.getElementById(Id).style.backgroundColor='#E4E4E4';
}

function Change(Id)

{           // alert(Id);
		     document.getElementById(Id).className='td';
             document.getElementById(Id).style.backgroundColor='#E4E4E4';
}

/////////////////////////////////ajax//////////////////////////////////////////////////////////////
function kill(Id)
{				
				 document.getElementById(Id).className='td1';
    	         document.getElementById(Id).style.backgroundColor='White';
}

function hide()
{	document.getElementById("txtHint").innerHTML="";
	document.getElementById("txtHint").style='height:0px';
}
var xmlHttp
function showHint(strid)
{
			var str=strid.substr(1);
		    document.getElementById(strid).className='td';
if (str==0)
  { 
  document.getElementById("txtHint").innerHTML="";
  return;
  }
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url=domain+"submenu.php";
url=url+"?CatId="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 
function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
document.getElementById("txtHint").innerHTML=xmlHttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
// Channel js Starts Here //
function CreateTable(obj,objId)
{
  var html = "";
  html += "<table width='100%' cellspacing='0' bgcolor='#404040'  cellpadding='2' border='0' > ";
   html += "<tr>";
    html += "<td ><a class=a3 href=\"http://benelux.mcsquare.me/\" >Benelux</a></td>";
     html += "<td ><a class=a3 href=\"http://france.mcsquare.me/\">France</a></td>";
      html += "<td ><a class=a3 href=\"http://deutsch.mcsquare.me/\">Deutsch</a></td>";
	   html += "<td><a class=a3 href=\"http://india.mcsquare.me/\">India</a></td>";
	    html += "<td ><a class=a3 href=\"http://chinese.mcsquare.me/\">Chinese</a></td>";
		 html += "<td><a class=a3 href=\"http://asia.mcsquare.me/\">Asia</a></td>";
		  html += "<td ><a class=a3 href=\"http://japan.mcsquare.me/\">japan</a></td>";
  html += "</tr><tr>";
   html += "<td ><a class=a3 href=\"http://uk.mcsquare.me/\">Uk</a></td>";
    html += "<td ><a class=a3 href=\"http://africa.mcsquare.me/\">Africa</a></td>";
	 html += "<td ><a class=a3 href=\"http://arabs.mcsquare.me/\">Arabs</a></td>";
	  html += "<td ><a class=a3 href=\"http://orient.mcsquare.me/\">Middle-East</a></td>";
	   html += "<td ><a class=a3 href=\"http://portugues.mcsquare.me/\">Portugues</a></td>";
	    html += "<td ><a class=a3 href=\"http://espagnol.mcsquare.me/\">Espagnol</a></td>";
		 html += "<td ><a class=a3 href=\"http://canada.mcsquare.me/\">Canada </a></td>";
   html += "</tr><tr>";
   html += "<td ><a class=a3 href=\"http://russia.mcsquare.me/\">Russia</a></td>";
    html += "<td ><a class=a3 href=\"http://osteu.mcsquare.me/\">Eastern-europe</a></td>";
	 html += "<td ><a class=a3 href=\"http://italia.mcsquare.me/\">Italia </a></td>";
	  html += "<td ><a class=a3 href=\"http://turkiye.mcsquare.me/\">Turkiye</a></td>";
	   html += "<td ><a class=a3 href=\"http://northeu.mcsquare.me/\">Northern Europe</a></td>";
	    html += "<td ><a class=a3 href=\"http://downunder.mcsquare.me/\">Down under</a></td>";
		 html += "<td ><a class=a3 href=\"http://safri.mcsquare.me/\">South Africa</a></td>";
    html += "</tr>";
   html += "</table>";
  document.getElementById("channel").style.backgroundColor="#404040";
  document.getElementById("Achannel").className='a3';
  var divC=document.getElementById( "divHolder" );
	document.getElementById( "divHolder" ).style.position="absolute";       
	document.getElementById( "divHolder" ).style.left= 30 +'%';
	document.getElementById( "divHolder" ).style.top=  25 +'px';
	document.getElementById( "divHolder" ).style.width=620 +'px';
	document.getElementById( "divHolder" ).style.height=100 +'px';
  document.getElementById( "divHolder" ).innerHTML = html;
		 if(objId!="divHolder")
		 {obj.onmouseout=function ()
			{	
				document.getElementById( "divHolder" ).style.visibility="visible";
				//alert('hello');
			}			
		}
}
function kill()
{			
	document.getElementById("channel").style.backgroundColor="#E4E4E4";
	document.getElementById("Achannel").className='a1';
	var divC=document.getElementById( "divHolder" );
	document.getElementById( "divHolder" ).style.position="absolute";       
	document.getElementById( "divHolder" ).style.left= 30 +'%';
	document.getElementById( "divHolder" ).style.top=  40 +'px';
	document.getElementById( "divHolder" ).style.width=60 +'px';
	document.getElementById( "divHolder" ).style.height=0 +'px';
    document.getElementById( "divHolder" ).innerHTML = "";
}
function hide_ch()
{
		document.getElementById( "divHolder" ).style.visibility='hidden';
		document.getElementById("channel").style.backgroundColor="#E4E4E4";
		document.getElementById("Achannel").className='a1';
}
// Script js Starts Here //
/* layerlib.js: Simple Layer library with basic
compatibility checking */
/* detect objects */
var layerobject = ((document.layers) ? (true) : (false));
var dom = ((document.getElementById) ? (true) : (false));
var allobject = ((document.all) ? (true) : (false));
opera=navigator.userAgent.toLowerCase().indexOf('opera')!=-1;
function getElement(layerName,parentLayer)
{
if(layerobject)
{
parentLayer = (parentLayer)? parentLayer : self; layerCollection = parentLayer.document.layers;
if (layerCollection[layerName])
return layerCollection[layerName];
/* look through nested layers */
for(i=0; i < layerCollection.length;)
return(getElement(layerName, layerCollection[i++]));
}
if (allobject)
return document.all[layerName];
if (dom)
return document.getElementById(layerName);
}
/* hide the layer with id = layerName */
function hide(layerName)
{
var theLayer = getElement(layerName);
var imid=document.getElementById('videoholder').innerHTML='';
if (layerobject)
theLayer.visibility = 'hide';
else
theLayer.style.visibility = 'hidden';
}
/* show the layer with id = layerName */
function show(layerName)
{
var theLayer = getElement(layerName);
if (layerobject)
theLayer.visibility = 'show';
else
theLayer.style.visibility = 'visible';
}
function OpenVideo(id,title,long_link,long_url)
{
var twid=document.getElementById('twitter').innerHTML='<a href="http://www.mcquadr.at/shorturl.php?long_url='+long_url+'&&long_link='+long_link+'&&title_tip='+title+'"  target="_blank"><img src=\"'+domain+'images/twitter_ico.png\" style="border:none;"></a>';
	show('videobox');
	show('videoboxbg');	

var imid=document.getElementById('videoholder').innerHTML='<div style="padding:10px;"><object style="margin-top:10px;" width="425" height="344"><param name="movie" value="http://www.youtube.com/v/'+id+'&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'+id+'&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></div>';
	show('videobox');
	show('videoboxbg');	
}
function OtherVideo(id,title,long_link,long_url)
{
	var twid=document.getElementById('twitter').innerHTML='<a href="http://www.mcquadr.at/shorturl.php?long_url='+long_url+'&&long_link='+long_link+'&&title_tip='+title+'" target="_blank"><img src=\"'+domain+'images/twitter_ico.png\" style="border:none;" ></a>';
	show('videobox');
	show('videoboxbg');
	
var imid=document.getElementById('videoholder').innerHTML='<div style="padding:25px;"><embed src="http://www.metacafe.com/fplayer/'+id+'.swf" width="400" height="345" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowFullScreen="true"> </embed></div>';
	show('videobox');
	show('videoboxbg');	
	
}
function HuluVideo(id,title,long_link,long_url)
{
	var twid=document.getElementById('twitt').innerHTML='<a href="http://www.mcquadr.at/shorturl.php?long_url='+long_url+'&&long_link='+long_link+'&&title_tip='+title+'" target="_blank"><img src=\"'+domain+'images/twitter_ico.png\" style="border:none;"></a>';
	show('commentbox');
	show('commentboxbg');

var imid=document.getElementById('commentholder').innerHTML='<div style="padding:10px;"><object width="512" height="296"><param name="movie" value="http://www.hulu.com/embed/'+id+'"></param><param name="allowFullScreen" value="true"></param><embed src="http://www.hulu.com/embed/'+id+'" type="application/x-shockwave-flash" allowFullScreen="true"  width="512" height="296"></embed></object></div>';
	show('commentbox');
	show('commentboxbg');	
}
function ViddlerVideo(id,title,long_link,long_url)
{
	var twid=document.getElementById('twitte_r').innerHTML='<a href="http://www.mcquadr.at/shorturl.php?long_url='+long_url+'&&long_link='+long_link+'&&title_tip='+title+'" target="_blank"><img src=\"'+domain+'images/twitter_ico.png\" style="border:none;"></a>';
	show('viddlerbox');
	show('viddlerboxbg');

var imid=document.getElementById('viddlerholder').innerHTML='<div style="padding:10px; padding-top:45px;"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="437" height="263" id="viddler_e5c57e8f"><param name="movie" value="http://www.viddler.com/player/'+id+'" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><embed src="http://www.viddler.com/player/'+id+'" width="437" height="263" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" name="viddler_e5c57e8f"></embed></object></div>';
	show('viddlerbox');
	show('viddlerboxbg');	
}      
// Formc(comment) js Starts Here //
/* hide the layer with id = layerName */
function hideC1(layerName)
{
var theLayer = getElement(layerName);
var imid=document.getElementById('div0').innerHTML='';
if (layerobject)
theLayer.visibility = 'hide';
else
theLayer.style.visibility = 'hidden';
}
/* show the layer with id = layerName */
function showC1(layerName)
{
var theLayer = getElement(layerName);
if (layerobject)
theLayer.visibility = 'show';
else
theLayer.style.visibility = 'visible';
}
function OpenWin(rssid,rowid,cid,sid,v,title,title_tip,permalink,rss_url,long_link,long_url,comment_target,comment_title,comment_ad,shorturls,evt)
{
		
		if(!cid)
		{ cid=0; }
		var x=0;
		var y=0;
	var div0=document.getElementById("div0");
	var mydiv=document.getElementById("divTitle");
	var mydiv1=document.getElementById("div1");
	document.getElementById("videobox1").style.height=442 +'px';
	div0.style.width=502 +'px';
	div0.style.height=442 +'px';
	div0.style.background="#ffffff";
	div0.innerHTML="";
	div0.appendChild(mydiv);
  mydiv.innerHTML =
	"<table width=100% cellspacing=0><tr bgcolor=#6C8B3F><td ><font color=white><b>&nbsp;&nbsp;"+ title_tip +"</b></font></td>"
			+ "<td  align=center style='width:30px;background-color:#666666;'><a  title=\"Close\"  onclick=\"CloseWin();\" style='color:#ffffff;cursor:pointer;text-decoration:none; font-size:12px;'>X</a></font></td>"
		  +	"</tr></table>"
		  + "<table width=100%><tr>"
		  + "<td height=\"30\" align=center bgcolor=white id=AddC onclick=\"OpenWindow(" + rssid +",'" +rowid+ "','" + cid +"',"+ sid +"," + v +",'" + comment_target +"','" + comment_title +"','" + comment_ad +"');\" style='border:.05em solid gray;border-bottom:none;' >Add Comment</button></td>"
		  + "<td height=\"30\" align=center bgcolor=gray  id=AllC onclick=\"toggle(" + rssid +",'" +rowid+ "','" + cid +"',"+ sid +"," + v +");\" style='border:.05em solid gray;font-weight:bold;'><a href='javascript:void();' style='text-decoration:none;'><font color=white>All Comments</font></a></td>"
		  + "<td width=20% align=right height=\"40\"></td>"
		   + "<td width=10% align=right height=\"40\"> <a href=\""+rss_url+"\"><img src=\""+domain+"images/rss.png\" height=\"50\" width=\"50\"  style='border:none;'></a></td>" 
	 	  + "<td width=10% align=right height=\"40\"><a href=\"http://www.mcquadr.at/shorturl.php?title_tip="+title_tip+"&&long_link="+long_link+"&&long_url="+long_url+"\" target=\"_blank\"><img src=\""+domain+"images/twitt.png\" height=\"50\" width=\"50\"  style='border:none;'></a></td></tr></table>";
		//alert(DIV1);
	div0.appendChild(mydiv1); 
    mydiv1.innerHTML =  
	 	  	"<br><center><form action=\""+domain+"comment.php\" name=Addc method=post onsubmit='return checkFM();'>"
	 	  + "<fieldset style='width:440px'>"
          + "<legend>New Comment</legend><br><table align=center style='font:11px verdana;'>"
          + "<tr><td align=right><b>Name:</b><br>[Required]</td>"
          + "<td align=left><input type=text  name=name  style='width:360px'/></td></tr>"
          + "<tr><td align=right><b>Email:</b><br>[Required]</td>"
          + "<td align=left><input type=text name=email style='width:360px'/></td></tr>"
          + "<tr><td align=right><b>Website:</b></td>"
          + "<td align=left><input type=text name=website style='width:360px' /></td></tr>"
		  + "<tr><td align=right><b>Comment:</b><br>[Required]</td>"
		  + "<td align=left><textarea name=comment cols=50 rows=8 style='font-size:11px;font-family:verdana;width:360px;'></textarea></td></tr>"
		  + "<tr><td align=center colspan=2><br><input type=hidden name=rssid value=" + rssid + "  />"
          + "<input type=hidden name=rowid value=" + rowid + "  />"
		  + "<input type=hidden name=cid value=" + cid + "  />"
          + "<input type=hidden name=sid value=" + sid + "  />"
		   + "<input type=hidden name=v value=" + v + "  />"
          + "<input type=submit value=Save />"
		   + "&nbsp;&nbsp;<input type=reset value=Reset /></td></tr></table>"
          + "</fieldset></form></center>"
	+"<table align=center style='font:11px verdana'><tr><td><a href=\"http://"+comment_target+"\" target=\"_blank\" style='font-family:verdana;font-size:14px;color:#0046d5;font-weight:bold;text-transform:capitalize'>"+comment_title+"</a></td></tr><tr><td style='font-family:verdana;font-size:11px;'>"+comment_ad+"</td></tr></table>";
	 showC1('videobox1');
	showC1('videoboxbg');	
}
function OpenWindow(rssid,rowid,cid,sid,v,comment_target,comment_title,comment_ad)
{
	var div0=document.getElementById("div0");
	var mydiv1=document.getElementById("div1");	
	div0.appendChild(mydiv1);
	document.getElementById("videobox1").style.height=442 +'px';
	div0.style.height=442 +'px';
	//mydiv1.style.height=320 +'px';
	mydiv1.innerHTML="";
	toggle_a();
     mydiv1.innerHTML = 
	 	  "<br><center><form action=\""+domain+"comment.php\" name=Addc method=post onsubmit='return checkFM();'>"
	 	  + "<fieldset style='width:440px;'>"
          + "<legend>New Comment</legend><br><table align=center style='font:11px verdana;'>"
          + "<tr><td align=right><b>Name:</b><br>(Required)</td>"
          + "<td align=left><input type=text  name=name value=\"\" style='width:360px;'/></td></tr>"
          + "<tr><td align=right><b>Email:</b><br>(Required)</td>"
          + "<td align=left><input type=text name=email style='width:360px;'/></td></tr>"
          + "<tr><td align=right><b>Website:</b></td>"
          + "<td align=left><input type=text name=website style='width:360px;' /></td></tr>"
		  + "<tr><td align=right><b>Comment:</b><br>(Required)</td>"
		  + "<td align=left><textarea name=comment cols=50 rows=8 style='font-size:11px;font-family:verdana;width:360px;'></textarea></td></tr>"
		  + "<tr><td align=center colspan=2><br><input type=hidden name=rssid value=" + rssid + "/>"
          + "<input type=hidden name=rowid value=" + rowid + "  />"
		  + "<input type=hidden name=cid value=" + cid + "  />"
          + "<input type=hidden name=sid value=" + sid + "  />"
		   + "<input type=hidden name=v value=" + v + "  />"
          + "<input type=submit value=\"Save\"/>"
		   + "&nbsp;&nbsp;<input type=reset value=\"Reset\" /></td></tr></table>"
          + "</fieldset></form></center>"
		  +"<table align=center style='font:11px verdana'><tr><td><a href=\"http://" + comment_target + "\" target=\"_blank\" style='font-family:verdana;font-size:14px;color:#0046d5;font-weight:bold;text-transform:capitalize'>" + comment_title + "</a></td></tr><tr><td style='font-family:verdana;font-size:11px;'>" + comment_ad + "</td></tr></table>";
		  showC1('videobox1');
		  showC1('videoboxbg');	
}
function toggle_b()
{
	document.getElementById("AllC").className='td';
	document.getElementById("AllC").innerHTML= " ";
	document.getElementById("AllC").innerHTML="<font color=black>All Comments</font>";
	document.getElementById("AllC").style.backgroundColor="white";
	document.getElementById("AllC").style.borderBottom="none";
	document.getElementById("AddC").className='td';
	document.getElementById("AddC").innerHTML= " ";
	document.getElementById("AddC").innerHTML="<a href='javascript:void();' style='text-decoration:none;'><font color=white>Add Comment</font></a>";
	document.getElementById("AddC").style.backgroundColor="gray";
}
function toggle_a()
{
	document.getElementById("AddC").className='td';
	document.getElementById("AddC").innerHTML= " ";
	document.getElementById("AddC").innerHTML="<font color=black>Add Comment</font>";
	document.getElementById("AddC").style.backgroundColor="white";
	document.getElementById("AddC").style.borderBottom="none";
	document.getElementById("AllC").className='td';
	document.getElementById("AllC").innerHTML= " ";
	document.getElementById("AllC").innerHTML="<a href='javascript:void();' style='text-decoration:none;'><font color=white>All Comments</font></a>";
	document.getElementById("AllC").style.backgroundColor="gray";
	
}
function ReplyWindow(rssid,rowid,cid,sid,v,rid,comment_target,comment_title,comment_ad)
{
	
	var div0=document.getElementById("div0");
	var mydiv1=document.getElementById("div1");	
	div0.appendChild(mydiv1);
	document.getElementById("videobox1").style.height=442 +'px';
	div0.style.height=442 +'px';
	//mydiv1.style.height=320 +'px';
	mydiv1.innerHTML="";
	toggle_a();
     mydiv1.innerHTML = 
	 	  "<br><center><form action=\""+domain+"comment.php\" name=Addc method=post onsubmit='return checkFM();'>"
	 	  + "<fieldset style='width:440px;'>"
          + "<legend>New Comment</legend><br><table align=center style='font:11px verdana;'>"
          + "<tr><td align=right><b>Name:</b><br>(Required)</td>"
          + "<td align=left><input type=text  name=name value=\"\" style='width:360px;'/></td></tr>"
          + "<tr><td align=right><b>Email:</b><br>(Required)</td>"
          + "<td align=left><input type=text name=email style='width:360px;'/></td></tr>"
          + "<tr><td align=right><b>Website:</b></td>"
          + "<td align=left><input type=text name=website style='width:360px;' /></td></tr>"
		  + "<tr><td align=right><b>Comment:</b><br>(Required)</td>"
		  + "<td align=left><textarea name=comment cols=50 rows=8 style='font-size:11px;font-family:verdana;width:360px;'></textarea></td></tr>"
		  + "<tr><td align=center colspan=2><br><input type=hidden name=rssid value=" + rssid + "/>"
          + "<input type=hidden name=rowid value=" + rowid + "  />"
		  + "<input type=hidden name=cid value=" + cid + "  />"
          + "<input type=hidden name=sid value=" + sid + "  />"
		   + "<input type=hidden name=v value=" + v + "  />"
		   + "<input type=hidden name=rid value=" + rid + "  />"
          + "<input type=submit value=\"Save\"/>"
		   + "&nbsp;&nbsp;<input type=reset value=\"Reset\" /></td></tr></table>"
          + "</fieldset></form></center>";
		  showC1('videobox1');
		  showC1('videoboxbg');	
}
function checkFM()
{
	if(document.Addc.name.value=="")
	{
		alert('Please Enter Name');
		return false;
	}
	else if(document.Addc.email.value=="")
	{
		alert('Please Enter Email');
		return false;
	}
	else if(document.Addc.comment.value=="")
	{
		alert('Please Enter Comment');
		return false;
	}
	else
	{
		return true;
	}
	return true;
}
function CloseWin()
{
	hide('videobox1');
	hide('videoboxbg');
}
var xmlHttp=false;
function toggle(rssid,rowid,cid,subid,v)
{
xmlHttp=false;
document.getElementById("div1").innerHTML=" ";
toggle_b();
xmlHttp=GetXmlHttpObjectf();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
  document.getElementById("div1").innerHTML="<br><br><dd><dd><font size=2 ><b>Loading.....</b></font><br><br>";
  document.getElementById("videobox1").style.height=501 +'px';
  document.getElementById("div0").style.height=500 +'px';
  document.getElementById("div1").style.height=420 +'px';
  document.getElementById("div1").style.overflowY = 'auto';
var url=domain+"AllComment.php";
url=url+"?rssid="+rssid;
url=url+"&rowid="+rowid;
url=url+"&cid="+cid;
url=url+"&subid="+subid;
url=url+"&v="+v;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedf;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
} 
function stateChangedf() 
{ 
if (xmlHttp.readyState==4)
{ 
	document.getElementById("div1").innerHTML= xmlHttp.responseText;
}
}
function GetXmlHttpObjectf()
{
var xmlHttp=false;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}
