// JavaScript Document
   var qtype;
   intervalID = window.setInterval("animalate()", 60000);
           function get_cookie ( cookie_name )
			{
			  var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );
			
			  if ( results )
			    return ( unescape ( results[1] ) );
			  else
			    return null;
			}
		   
           function setCookie(NameOfCookie, value, expiredays, path, domain, secure)
			{
			  //the first lines in the function converts the number of days to a valid date.
			
			  var ExpireDate = new Date();
			  ExpireDate.setTime(ExpireDate.getTime() + (expiredays*24*3600*1000));
			
			  //The next line stores the cookie, simple by assigning
			  //the values to the document.cookie-object
			  //Note the date is converted to Greenwich Meantime using
			  //the 'toGMTstring()'-function
			
			  document.cookie = NameOfCookie +"="+ escape(value) + 
			  ((expiredays == null)? "": ";expires="+ ExpireDate.toGMTString()) +
			  ((path == null)? "": (";path=" + path)) +
			  ((domain == null) ? "" : (";domain=" + domein)) +
			  ((secure == true) ?";secure":"");
			}
	
           function getqtype(control){
             qtype = control.value;
           }
           function setqtype() {
				if (qtype == null) {
				   qtype = get_cookie ( "qtype" );
				 }
				 else {
				   setCookie("qtype",qtype,1);
				 }
				 if (qtype=='text') {
			     	 document.getElementById('videoplayer').innerHTML  = "<iframe id='init' src='askbroeli.aspx' frameborder='0' width='444' scrolling='no' height='333'></iframe>";
			     	 }
		     	 else {
		     		 document.getElementById('videoplayer').innerHTML  = "<iframe id='init' src='flashvid/tc2.swf' frameborder='0' scrolling='no' width='700' height='397'></iframe>";
				 }
				 
				 //alert('ang question na ay: ' + qtype);
				 // lastclipplayed()
           }
           
           function showflashplayer(rmclipsource) {
             var strhtm = '';
             strhtm = strhtm + "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0' width='444' height='333' title='TCPLAYER' id='Shockwaveflash1' VIEWASTEXT>";
             strhtm = strhtm + "<param name='movie' value='" + rmclipsource + "' />";
             strhtm = strhtm + "<param name='quality' value='high' />";
             strhtm = strhtm + "<embed src='" + rmclipsource + "' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='444' height='333'></embed>";
             strhtm = strhtm + "</object>";
             parent.document.getElementById('videoplayer').innerHTML = strhtm;
           }
           
           function showstep1() {
            var strhtm = '';
            strhtm = strhtm + "<table id='tqtable' width='100%' align='center'>";
			strhtm = strhtm + "<tr><td class='td1'>Step 1/2 Ask Bro Eli &nbsp;</td></tr>";
			strhtm = strhtm + "<tr><td class='td2'>Please Select Below</td></tr>";
			strhtm = strhtm + "<tr><td><input id='opt1' type='radio' value='text' onclick='getqtype(this)' name='R1'>Post a text Question (<i>if you don't have a webcam</i>)</td></tr>";
			strhtm = strhtm + "<tr><td><input id='opt2' type='radio' value='video' onclick='getqtype(this)'  name='R1'>Post a Video Question</td></tr>";
			strhtm = strhtm + "<tr><td><input id='btn1' type='button' value='Next' name='B1' onClick='setqtype()'></td></tr>";
			strhtm = strhtm + "</table>";
            document.getElementById('videoplayer').innerHTML = strhtm;
           }
           function showplayer(rmclipsource) {
			var strhtm = '';
					// strhtm = strhtm + "<OBJECT id='Player2' height='333' width='444' classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'";
					// strhtm = strhtm + " name='OldPathTV' VIEWASTEXT>";
					// strhtm = strhtm + "<PARAM NAME='URL' VALUE='" + rmclipsource + "'>";
					// strhtm = strhtm + "<PARAM NAME='uiMode' VALUE='full'>";
					// strhtm = strhtm + "<embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' filename='" + rmclipsource + "' name='Truthcaster' height='333' width='444' ";
					// strhtm = strhtm + " autostart='1' showcontrols='1' showdisplay='0' showstatusbar='0'> </embed>";
					// strhtm = strhtm + "</OBJECT>";
					
					strhtm = strhtm + "<img src='images/skin.jpg' usemap='#FPMap0' border='0'>";
					strhtm = strhtm + "<map name='FPMap0'>";
                    strhtm = strhtm + "<area href='#' onclick='javascript:document.Player2.URL =  \""+ rmclipsource  + "\"' shape='rect' coords='74, 280, 100, 306'>";
					strhtm = strhtm + "<area href='#' onClick='javascript:document.Player2.controls.stop();' shape='rect' coords='103, 277, 127, 306'>";
					strhtm = strhtm + "</map>";
					strhtm = strhtm + "<div style='position: absolute; width: 100px; height: 100px; z-index: 1; left:388px; top:218px' id='layerskin'>";
					
					// strhtm = strhtm + "<OBJECT id='Player2' height='240' width='320' classid='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6'";
					// strhtm = strhtm + " name='OldPathTV' VIEWASTEXT>";
					// strhtm = strhtm + "<PARAM NAME='URL' VALUE='" + rmclipsource + "'>";
					// strhtm = strhtm + "<PARAM NAME='uiMode' VALUE='none'>";
					// strhtm = strhtm + "<param name='stretchToFit' value='1'>";
                    // strhtm = strhtm + "<embed type='application/x-mplayer2' pluginspage='http://www.microsoft.com/Windows/MediaPlayer/' filename='" + rmclipsource + "' name='Truthcaster' height='240' width='320' ";
					// strhtm = strhtm + " autostart='1' showcontrols='1' showdisplay='0' showstatusbar='0'> </embed>";
					// strhtm = strhtm + "</OBJECT>";
					strhtm = strhtm + "<OBJECT ID='Player2' CLASSID='CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6' WIDTH='320' HEIGHT='240'>";
					strhtm = strhtm + "<PARAM NAME='AutoStart' VALUE='True' >";
					strhtm = strhtm + "<PARAM NAME='URL' VALUE='" + rmclipsource + "'>";
					strhtm = strhtm + "<param name='stretchToFit' value='1'>";
					strhtm = strhtm + "<PARAM NAME='uiMode' VALUE='none'>";
					strhtm = strhtm + "<EMBED TYPE='application/x-mplayer2'"; 
					strhtm = strhtm + "  SRC='" + rmclipsource + "'";
					strhtm = strhtm + " NAME='Player2'";
					strhtm = strhtm + "  WIDTH='320'";
					strhtm = strhtm + "  HEIGHT='240'";
					strhtm = strhtm + "  AUTOSTART='1'";
					strhtm = strhtm + "  SHOWCONTROLS='0'>";
					strhtm = strhtm + " </EMBED>";
					strhtm = strhtm + " </OBJECT>";					
					strhtm = strhtm + "</div>";
    	            document.getElementById('videoplayer').innerHTML = strhtm;
			}
			function showrealplayer(rmclipsource) {
			var strhtm = '';
			strhtm = strhtm + "<object id='myMovie' classid='CLSID:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' height='283' width='444' VIEWASTEXT>";
            strhtm = strhtm + "<param name='controls' value='ImageWindow'>";
            strhtm = strhtm + "<param name='console' value='_master'>";
            strhtm = strhtm + "<param name='center' value='0'>"; 
            strhtm = strhtm + "<param name='AUTOSTART' value='-1'>";
            strhtm = strhtm + "<param name='SHUFFLE' value='0'>";
            strhtm = strhtm + "<param name='PREFETCH' value='0'>";
            strhtm = strhtm + "<param name='NOLABELS' value='0'>";
            strhtm = strhtm + "<param name='LOOP' value='0'>";
            strhtm = strhtm + "<param name='NUMLOOP' value='0'>";
            strhtm = strhtm + "<param name='MAINTAINASPECT' value='0'>";
            strhtm = strhtm + "<param name='BACKGROUNDCOLOR' value='#000000'>";
            strhtm = strhtm + "<embed name='myMovie' src='" + rmclipsource + "' height='250' width='542' nojava='true' controls='ImageWindow' console='_master' center='true' pluginspage='http://www.real.com/'></embed> ";
            strhtm = strhtm + "</object><br>";
            strhtm = strhtm + "<object id='myMovie' classid='clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA' width='444' height='50' VIEWASTEXT>";
            strhtm = strhtm + "<param name='src' value='" + rmclipsource + "' ref>";
            strhtm = strhtm + "<param name='console' value='video1'>";
            strhtm = strhtm + "<param name='controls' value='All'>";
            strhtm = strhtm + "<param name='autostart' value='-1'>";
            strhtm = strhtm + "<param name='loop' value='0'>";
            strhtm = strhtm + "<param name='SHUFFLE' value='0'>";
            strhtm = strhtm + "<param name='PREFETCH' value='0'>";
            strhtm = strhtm + "<param name='NOLABELS' value='0'>";
            strhtm = strhtm + "<param name='NUMLOOP' value='0'>";
            strhtm = strhtm + "<param name='CENTER' value='0'>";
            strhtm = strhtm + "<param name='MAINTAINASPECT' value='0'>";
            strhtm = strhtm + "<param name='BACKGROUNDCOLOR' value='#000000'>";
            strhtm = strhtm + "<embed name='myMovie' src='s3n2.ram' height='100' width='540' autostart='false' loop='false' nojava='true' console='video1' controls='All'></embed>";
            strhtm = strhtm + "<noembed><a href='" + rmclipsource + "'>Play first clip</a></noembed>";
            strhtm = strhtm + "</object>";
            document.getElementById('videoplayer').innerHTML = strhtm;
            //http://www.theoldpath.tv/livecontent/s3n2.ram
			}
			
			// onload="showplayer('http://61.9.8.114/addtv/q/q1049/q1049-128.wmv');"
			function closeme()
			{
			  //document.getElementById('Speciallive').style.visibility = "hidden";
			 
			}
			function stopme() {
			window.clearInterval(intervalID)
			}

		function setCookie(NameOfCookie, value, expiredays, path, domain, secure)
			{
			//the first lines in the function converts the number of days to a valid date.

			var ExpireDate = new Date();
			ExpireDate.setTime(ExpireDate.getTime() + (expiredays*24*3600*1000));

			//The next line stores the cookie, simple by assigning
			//the values to the document.cookie-object
			//Note the date is converted to Greenwich Meantime using
			//the 'toGMTstring()'-function

			document.cookie = NameOfCookie +"="+ escape(value) + 
			((expiredays == null)? "": ";expires="+ ExpireDate.toGMTString()) +
			((path == null)? "": (";path=" + path)) +
			((domain == null) ? "" : (";domain=" + domein)) +
			((secure == true) ?";secure":"");
			}

			function callback_datareturn(res) {
			       if (res.value==null)
					        {
						   // document.getElementById('live').style.visibility = "hidden";	
						    }
					else if (res.value == 'nosched')
					    {
					   // document.getElementById('live').style.visibility = "hidden";
					    }	    
					else
					 {
					      // document.getElementById('live').style.visibility = "visible";
					      // document.getElementById('live').innerHTML = res.value; 
					      document.getElementById('videoplayer').style.visibility = "visible";
					      document.getElementById('videoplayer').innerHTML = res.value; 
					      stopme(); 
					      
					 }     
					}
			function animalate()    
			{ 
    			now = new Date();
				// month date year time
				var today=new Date()
				var curmonth = today.getMonth() + 1;
				var curdate  = today.getDate()
				var curyear  = today.getFullYear()
				var curtime = today.getTime()
				var fulltime = today.getHours() + ':' + today.getMinutes();   
				// var sendthis = curmonth + '/' + curdate + '/' + curyear + '|' + now;
				var sendthis = curmonth + '/' + curdate + '/' +  curyear +  ' ' + fulltime;
				//Tue Jun 27 15:08:21
				
    			oldpathajax.tcevents(sendthis,callback_datareturn);
    			//window.clearInterval(intervalID)
			}
			
			function callback_datareturnko(res) {
			       	if (res.value==null)
					        {
						    document.getElementById('live').style.visibility = "hidden";	
						    }
					else if (res.value == 'nosched')
					    {
					    document.getElementById('live').style.visibility = "hidden";
					    }	    
					else
					 {
					      document.getElementById('live').style.visibility = "visible";
					      document.getElementById('live').innerHTML = res.value; 
					      //stopme(); 
					      
					 }     
					}
			function animalateko() {
				now = new Date();
				// month date year time
				var today=new Date()
				var curmonth = today.getMonth() + 1;
				var curdate  = today.getDate()
				var curyear  = today.getFullYear()
				var curtime = today.getTime()
				var fulltime = today.getHours() + ':' + today.getMinutes();   
				var sendthis = curmonth + '/' + curdate + '/' +  curyear +  ' ' + fulltime;
				oldpathajax.tceventsko(sendthis,callback_datareturnko);
   			}
   			
   	function Createvidcookiemedia(myid) {
   	      // alert(myid); 
          document.getElementById('init').src = "getcookies.aspx?myid=" + myid;
    }		
   			
   	function checkbrowser()
	{
	var browserName=navigator.appName; 
	if (browserName=="Netscape")
	{ 
	 document.getElementById('init').src = 'playerlive1.htm';  
	}
	else 
	{ 
	 if (browserName=="Microsoft Internet Explorer")
	 {
	    document.getElementById('init').src = 'playerliveie.htm';  
	}
	 else
	  {
	    alert("What ARE you browsing with here?");
	   }
	}
	//-->
	
	}		
   			
   			
// ===================================================


function testingpopoy() {
var popoyplayer;
	popoyplayer = document.getElementById('Player2').playState()
	alert(popoyplayer);
}
