/* MG: JSON class constructor - use this one instead of the one in omniture.js */
Array.prototype.jsonClass=function(){
	var x=this;
	var constr=function(){
		var a=arguments; var u;
		for(var i=0;i<x.length;i++){
			if(typeof x[i]=="object"){
				for(var j in x[i]){this[j]=this[j]!=u?this[j]:x[i][j]}
			};
			if(typeof x[i]!="string" || a[i]===u){continue};
			this[x[i]]=a[i];
		}
	};
	var nextProto=false;
	for(var i=0;i<=x.length;i++){
		var a=x[i]||constr;
		if(typeof a=="function"){
			a.prototype=nextProto||a.prototype;
			nextProto=new a();
		}
	};
	constr.addMembers=function(obj){
		for(var i in obj){constr.prototype[i]=obj[i]}
	};
	return constr
};

/* extending members sample: MyClass.addMembers({key:'value'}) */

getVideoProperties=[
'prop1','prop2','prop3','prop4','prop5','prop6','prop7','prop8','prop9','prop10',
     {
          prop1:'',
          prop2:'',
          prop3:'',
          prop4:'',
          prop5:'',
          prop6:'',
          prop7:'',
          prop8:'',
          prop9:'',
          prop10:'',
          getProp1:function(){return this.prop1},
          getProp2:function(){return this.prop2},
          getProp3:function(){return this.prop3},
          getProp4:function(){return this.prop4},
          getProp5:function(){return this.prop5},
          getProp6:function(){return this.prop6},
          getProp7:function(){return this.prop7},
          getProp8:function(){return this.prop8},
          getProp9:function(){return this.prop9},
          getProp10:function(){return this.prop10}
     }
].jsonClass();

getCommentProperties=[
'prop1','prop2','prop3','prop4','prop5','prop6',
     {
          prop1:'',
          prop2:'',
          prop3:'',
          prop4:'',
          prop5:'',
          prop6:'',
          getProp1:function(){return this.prop1},
          getProp2:function(){return this.prop2},
          getProp3:function(){return this.prop3},
          getProp4:function(){return this.prop4},
          getProp5:function(){return this.prop5},
          getProp6:function(){return this.prop6}
     }
].jsonClass();

function ytvDisplay(sequence,total) {
	var current = sequence;
	var available = total;
	var current_plus = sequence + 1;
	

	
	document.write('<div id="frame">');
	document.write('<div id="strip" style="width:928px;margin-left:25px;">');
	document.write('<img src="http://www.cbs.com/can_player/images/partners.gif" alt="" width="928" height="55" border="0" />');
	document.write('<div class="clear"></div>');
	document.write('<div id="title1" style="height:50px;text-align:left;background:transparent url(http://www.cbs.com/can_player/images/title1_bg.gif) no-repeat top left scroll">');
	document.write('<p>' + current_plus + '. ' + ytvArray[current].prop4 + '</p>');
	//document.write('<span>Added on ' + ytvArray[current].prop3 + '</span>');
	document.write('</div>');
	document.write('<div class="clear"></div>');
	document.write('<div id="left">');
	document.write('<div id="views">');
	document.write('<p>' + ytvArray[current].prop8 + ' views</p>');
	document.write('</div>');
	document.write('<div class="clear"></div>');
	document.write('<div id="flash" style="float:left;width:425px;height:355px;">');
	document.write('</div>');
	document.write('<script type="text/javascript">var so = new SWFObject("http://www.youtube.com/v/' + ytvArray[current].prop2 + '&hl=en", "player", "425", "355", "8", "#000000");so.addParam("wmode","transparent");so.addParam("allowScriptAccess", "always");so.write("flash");</script>');
	document.write('</div>');
	/*document.write('<div id="right">');
	document.write('<div id="comments">');
	document.write('<p>' + ytvArray[current].prop10 + ' comments</p>');
	document.write('</div>');
	document.write('<div class="clear"></div>');
	document.write('<div id="commentframe" style="float:left;width:484px;">');
	
	for (var j=0;j<cCount;j++) {
	
		if (j < 5) {

			document.write('<div class="commentitem">');
			document.write('<p>' + cArray[j].prop5 + '</p>');
			document.write('<span>' + cArray[j].prop6 + '</span>');
			document.write('</div>');
		
		}

	}
	
	document.write('<div class="comment-closing" style="border-top:1px #ccc solid;width:484px;height:25px;text-align:right;padding-top:5px;"><a href="http://www.youtube.com/comment_servlet?all_comments&v=' + ytvArray[current].prop2 + '" class="link">View All Comments</a></div>');
	document.write('</div>');
	document.write('</div>');*/
	
	document.write('<div class="clear"></div>');
	document.write('<div class="verticalSpacer40"></div>');
	
	for (var i=0;i<ytvCount;i++) {

		if ((i != current) && (i < 10)) {
			
			i_plus = i + 1;

			document.write('<div class="videoitem">');
			document.write('<a href="?n=' + i + '" class="videolink"><img src="' + ytvArray[i].prop7 + '" alt="" width="130" height="97" border="0" class="videothumb" /></a>');
			document.write('<div class="video_info">');
			document.write('<span class="video_item_number">' + i_plus + '</span><br />');
			document.write('<a class="video_item_title" href="?n=' + i + '">' + ytvArray[i].prop4 + '</a>');
			//document.write('<span class="video_item_added">Added on ' + ytvArray[i].prop3 + '</span>');
			document.write('</div>');
			document.write('<div class="video_views_info">');
			document.write('<span class="video_views_title">Views</span><br />');
			document.write('<span class="video_item_title">' + ytvArray[i].prop8 + '</span><br />');
			document.write('</div>');
			document.write('<div class="video_comments_info">');
			document.write('<span class="video_views_title">Comments</span><br />');
			document.write('<span class="video_item_title">' + ytvArray[i].prop10 + '</span><br />');
			document.write('</div>');
			document.write('</div>');
			document.write('<div class="clear"></div>');				
		
		}
	}
	
	document.write('<div class="verticalSpacer40"></div>');
	document.write('</div>');
	document.write('</div>');
	document.write('<div class="clear"></div>');			
	document.write('<div id="closer"><img src="http://www.cbs.com/can_player/images/bg_content_bottom.jpg" alt="" width="1001" border="0" /></div>');
	document.write('');
	document.write('');
	document.write('');				

}

