﻿// JavaScript Document
function Set_Cookie( name, value, expires, path, domain, secure ) 
{
expireDate = new Date;
expireDate.setMinutes(expireDate.getMinutes()+(expires));//expires: minute
document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expireDate.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

function Get_Cookie( name ) {
var start = document.cookie.indexOf( name + "=" );
var len = start + name.length + 1;
if ( ( !start ) &&
( name != document.cookie.substring( 0, name.length ) ) )
{
return null;
}
if ( start == -1 ) return null;
var end = document.cookie.indexOf( ";", len );
if ( end == -1 ) end = document.cookie.length;
return unescape( document.cookie.substring( len, end ) );
}
function contactus()
{
	var win=window.open('/Contact.aspx', 'Contact', 'width=606,height=352,resizable=yes,scrollbars=yes,status=0');
}
function countCharacter()
{
	var count=getId('ctl00_ContentPlaceHolder1_txtContent').value.length;
	if(count>500)
	{
	getId('ctl00_ContentPlaceHolder1_txtContent').value=getId('ctl00_ContentPlaceHolder1_txtContent').value.substring(0,500);
	getId('cCount').innerHTML=500-getId('ctl00_ContentPlaceHolder1_txtContent').value.length;
	}
	else
	{
	getId('cCount').innerHTML=500-count;
	}
}
function tagName(t)
{return document.getElementsByTagName(t);}
function cElement(e)
{return document.createElement(e);}
function getId(i)
{return document.getElementById(i);}
function postToGoogle(t)
{
    if(document.getElementById('Google_title_Search').value!='')
    {
 //   var q='http://www.google.com/search?q=site%3A'+document.domain+'+';
    var q='http://www.google.com/search?q=site%3Awww.thetvnet.com+';
	q+=document.getElementById('Google_title_Search').value.replace(' ','+');
	q+='&hl=en&btnG=Search';
	t.href=q;	 
	t.target='_blank';
	document.getElementById('Google_title_Search').value='';
	}
}
function OpenWindow(url) {
  popupWin = window.open(url,'new_page','width=350,height=150')
}
// Using for browse images in server
function BrowseImages(url) {
  popupWin = window.open(url,'new_page','width=450,height=350,resizable=false')
}

// Using to show or hide div
function showMe (it, box) {
  var vis = (box.checked) ? "block" : "none";
  document.getElementById(it).style.display = vis;
}
function popupImage(src, note, title, css, border) {
var ppimgNW;
  if (border==null) border = 0;
  if (note==null) note = '';
  if (ppimgNW != null) ppimgNW.close();

  ppimgNW = window.open('','POPUPIMAGE','width=1,height=1,scrollbars');
 
  var doc = ppimgNW.document;
  doc.write('<html>');
  doc.write('<head>');

  if (title!=null) doc.write('<title>'+ title +'</title>');
  doc.write('<style> body {'+css+'} #ppImgText{'+ css +'} #ppImg{cursor:hand}</style></head>');
  doc.write('<body oncontextmenu="return false" leftmargin="0" topmargin="' + border + '">');
  doc.write('<div align="center">');
  doc.write('<img src="' + src + '" id="ppImg" onclick="self.close();" title="Close">');
  doc.write('</div>');
  doc.write('<div style="height:1; width:'+ border +'; font-size:4pt">');
  doc.write('</div>');
  doc.write('<div id="ppImgText" align="center">');
  doc.write('<Font face=Tahoma size=2>'+note+'</Font>');
  doc.write('</div>');
  doc.write('</body>');
  doc.write('</html>');

  doc.write('<' + 'script>');
  doc.write('var resized = false;');
  doc.write('function doResize() {');
  doc.write('  var imgW = document.getElementById(\'ppImg\').width, imgH = document.getElementById(\'ppImg\').height;');     
  if (note=='' || note==null) {addH=50} else {addH=90};
  doc.write('  window.resizeTo(imgW + 8 +' + border*2 +', imgH + ppImgText.offsetHeight + '+addH+' + '+ border*2 +');');
  doc.write('  setTimeout("doResize()",1000);');

  doc.write('}');
  doc.write('doResize(); ');
  doc.write('</' + 'script>');
}
function displayObj(videoUrl) {
var bnum = Math.round(Math.random()*9999);
var burl = "";
var bparam = "";
var bembed = "";
burl = videoUrl;
bparam="<div style='float: left; background: #000; border: 4px solid #000' align='center'>"
bparam = "<param name=\"FileName\" value=\""+burl+"\">";
bembed = "<embed type=\"application/x-mplayer2\" pluginspage = \"http://www.microsoft.com/Windows/MediaPlayer/\" src=\""
bembed = bembed + burl +"\" align=\"middle\" defaultframe=\"rightFrame\" showstatusbar=true width=\"400\" height=\"350\"></embed>";

document.write('<object id="MediaPlayer1" classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft. Windows. Media Player components..." type="application/x-oleobject" align="middle" width="400" height="350">\n');
document.write(bparam);
document.write('\n');
document.write('<param name="TransparentatStart" value="true">\n');
document.write('<param name="AutoStart" value="true">\n');
document.write('<param name="ShowControls" value="1">\n');
document.write(bembed);
document.write('\n');
document.write('</object></div>\n');
}


function addthis_click(){

 var aturl  = 'http://www.addthis.com/bookmark.php';
 aturl += '?v=10';
 aturl += '&pub=UX53BXEP84E28URL';
 aturl += '&url='+encodeURIComponent(location.href);
 aturl += '&title='+encodeURIComponent(document.title);

 window.open(aturl,'addthis','scrollbars=yes,menubar=no,width=620,height=520,resizable=yes,toolbar=no,location=no,status=no,screenX=200,screenY=100,left=200,top=100');
}
function show_Body()
{
var b=document.getElementsByTagName('body');
b[0].style.display='';
}
//setTimeout("show_Body()",3000);
function ss_showdetail(i){
$('ss_'+i).style.display='none';
$('sd_'+i).style.display='block';
$('sk_'+i).style.display='block';
}
function ss_hidedetail(i){
$('ss_'+i).style.display='block';
$('sd_'+i).style.display='none';
$('sk_'+i).style.display='none';
}
function ss_showdetail2(i){
$('ss_'+i).style.display='none';
$('sd_'+i).style.display='block';
$('ss_panelsumary').style.display='none';
$('ss_paneldetail').style.display='block';
}
function ss_hidedetail2(i){
$('ss_'+i).style.display='block';
$('sd_'+i).style.display='none';
$('ss_panelsumary').style.display='block';
$('ss_paneldetail').style.display='none';
}

function closead2play(){
$("mediaspace").style.display='none';
$("topytapiplayer").style.display='block';
setTimeout('ytplayvideo()',2000);
}

function ytplayvideo(){
ytplayer = $("myytplayer");
ytplayer.playVideo();
}