function drupal_video( name ){
          this.divid= '';
          this.videodata= [];
		  this.defaultcode = '';  
		  this.shtml = '';
		  this.name = name;
		  this.width = 400;
		  this.height = 300;
		  this.base="";
		  this.sessiontitle="";
		  this.nodeid =0;
		  this.title="";
	};
	drupal_video.prototype.setDivId=function ( divid ){
	           this.divid= divid;
	}; 
	drupal_video.prototype.setWidth =function ( w ){
			   this.width =w ;
	}; 
	drupal_video.prototype.setHeight =function ( h ){
			   this.height = h ;
	}; 
	drupal_video.prototype.setData=function ( data ){
	           this.videodata = data;
	};
	drupal_video.prototype.setDefaultCode=function ( code   ){
	           this.defaultcode=code;
	};
	drupal_video.prototype.setBaseurl=function ( base   ){
	           this.base=base;
	};
	drupal_video.prototype.setDefaultSession=function( t ){
			   this.sessiontitle =  t;
	};
	drupal_video.prototype.setDefaultNodeid=function( id ){
			   this.nodeid=  id;
	};
	drupal_video.prototype.setDefaultTitle=function( t ){
			   this.title=  t;
	};
	// video.setBaseurl 
    drupal_video.prototype.pay=function ( id  ,tf ){


		    document.getElementById( this.divid ).style.width = this.width;
		    document.getElementById( this.divid ).style.height  = this.height;

	 
		            var url =  this.videodata[ id ][2] + "&autoplay=" + tf;
		            var s  =  '<iframe  id="iframe1_video" border=0   marginwidth=0 marginheight=0        frameborder=no width="'+ this.width +'" scrolling=no             height="'+ this.height +'"    src="'+ this.base + 'naviagation/play/?src='+ escape( url ) +'&width='+ this.width +'&height='+ this.height +'&tf='+tf+'&nodeid='+ this.videodata[ id ][0] +'&session='+escape( this.videodata[ id ][3]  )+'&'+ Math.random() +'"></iframe>';
					
					
					//<div align="center">'+ this.videodata[ id ][1]  +'</div>';


				  //showvideo_title
				 
				  document.getElementById( this.divid ).innerHTML =s;
				  document.getElementById( this.divid + '_title').innerHTML = '<b>Playing: <font color="#ffffff">'+ this.videodata[ id ][1] +'</font></b>';
		 

	};

    drupal_video.prototype.paydefault=function ( url ){


		    document.getElementById( this.divid ).style.width = this.width ;
		    document.getElementById( this.divid ).style.height  = this.height;
			var tf = 0;

		 
	 
	            	 
	               var s  =  '<iframe  id="iframe1_video" border=0   marginwidth=0 marginheight=0        frameborder=no width="'+ this.width +'" scrolling=no             height="'+ this.height +'"    src="'+this.base + 'naviagation/play?src='+ escape( url ) +'&width='+ this.width +'&height='+ (this.height) +'&tf='+tf+'&nodeid='+this.nodeid+'&session='+escape(  this.sessiontitle  )+'&'+ Math.random() +'"></iframe>';
				   //<div align="center">'+ this.title  +'</div>';
				  
	        	   document.getElementById( this.divid ).innerHTML =s;

				   document.getElementById( this.divid + '_title').innerHTML = '<b>Playing: <font color="#ffffff">'+this.title +'</font></b>';
		 
	};

    drupal_video.prototype.toString =function ( ){
	  	       if (this.defaultcode!='')
	  	       {
				  this.paydefault ( this.defaultcode );
	  	       }else{
				  if ( this.videodata.length>0  )
				  {
					  this.pay( 0,0);
				  }
			   }
/*
	           var shtml = '<ul>'; 
			   for (var i=0; i<this.videodata.length ; i++)
			   { 
				  // shtml += '<tr><td><a href="javascript:'+this.name+'.pay('+i+',1)">'+ this.videodata[i][1] + '</a></td></tr>';
				   shtml += '<li><a  href="javascript:'+this.name+'.pay('+i+',1)">'+ this.videodata[i][1] + '</a></li>';
			   }
                 shtml += '</ul>';
              // shtml =  '<table border="1">' + shtml + '</table>';
			   this.shtml=  '<div class="All_Videos">' + shtml + '</div>';
*/
	           var shtml = '<table>'; 
			   for (var i=0; i<this.videodata.length ; i++)
			   { 
				    shtml += '<tr><td height="22"><a  class="a1"  href="javascript:'+this.name+'.pay('+i+',1)">'+ this.videodata[i][1] + '</a><br><a style="color:#047bcd; text-decoration:none;" href="javascript:'+this.name+'.pay('+i+',1)">View</a></td></tr>';
				  
				//   shtml += '<li><a  href="javascript:'+this.name+'.pay('+i+',1)">'+ this.videodata[i][1] + '</a></li>';
			   }
                 shtml += '</table>';
           
			  // this.shtml=  '<div class="All_Videos">' + shtml + '</div>';

			   this.shtml = shtml;


			   return  this.shtml;
	};

   drupal_video.prototype.view= function (nodeid, session, title , url , autoplay ){

		           if (autoplay==1)
		           {
					   url = url + "&autoplay=" + autoplay;
		           }
				   var theurl = this.base + 'naviagation/play?src='+ escape( url ) +'&width='+ this.width +'&height='+ (this.height) +'&tf='+autoplay+'&nodeid='+ nodeid +'&session='+escape(  session  )+'&'+  Math.random()  ;

	               var s  =  '<iframe  id="iframe1_video" border=0   marginwidth=0 marginheight=0        frameborder=no width="'+ this.width +'" scrolling=no             height="'+ this.height +'"    src="'+theurl+'"></iframe>'; 

                   if (  document.getElementById( "iframe1_video" ) )
                   {
					    document.getElementById( "iframe1_video" ).contentWindow.location.replace( theurl ) ;
                   }else{
	                    document.getElementById( this.divid ).innerHTML =s;
				   }

				   document.getElementById( this.divid + '_title').innerHTML = '<b>Playing: <font color="#ffffff">'+ title +'</font></b>';
		 
				if(document.body.scrollTop){
				  document.body.scrollTop = 0 ;
				}
				else{
				  document.documentElement.scrollTop=0;
				}
				 
					 
		 
	};