// Media Inventions javascript functions

// *************************************************************************************************
// FUNCTION TO BUILD A VIDEO LINK BASED ON AN ID IN THE MEDIA DATABASE
//
// Automatically switchs between Flash and iphone
// *************************************************************************************************
/*<a href="mediainventions_flvplayer_AS3.html"
			 onclick="return hs.htmlExpand(this, { 
			objectType: 'iframe', width: 512, height: 350, 
			creditsPosition: 'bottom left', headingText: 'Title from onclick', 
			wrapperClassName: 'titlebar' } )">Iframe</a>
			
*/			
function BuildVideoLink(videoid, videotitle, videolinktext,videoheader) {
	var iphone=false;

	if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
		//alert("on an iPhone");
		iphone=true;
	} 

	var flink="";
	if (iphone) {
		flink=flink + "<a class=\"videolink\" href='mediainventions_mp4play.php?id=" + videoid + "' title=\"" + videotitle + "\">";
	} else {
		flink=flink + "<a class='videolink' href='mediainventions_flvplay_AS3.php?id=" + videoid + "' ";
		flink=flink+"onclick=\"return hs.htmlExpand(this, {"; 
		flink=flink+" objectType: 'iframe', width: 512, height: 350, creditsPosition: 'bottom left', headingText: '" + videoheader + "', wrapperClassName: 'titlebar' } )\">";

/*		flink=flink+
		 onClick=\"return hs.htmlExpand(this, { objectType: 'swf', width: 580,";
		flink=flink+" objectWidth: 580, objectHeight: 345, maincontentText: 'You need to upgrade your Flash player',";
		flink=flink+"headingText: '"+videoheader+"', swfOptions: { version: '10', allowFullScreen: true, wmode: window }  } )\"";
		flink=flink+" class=\"highslide\" title=\"" + videotitle + "\">";
	*/
	}

	// add the link text
	flink=flink + videolinktext + "</span></a>";
	return flink;

}

/* SAFE			
function BuildVideoLink(videoid, videotitle, videolinktext,videoheader) {
	var iphone=false;

	if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
		//alert("on an iPhone");
		iphone=true;
	} 

	var flink="";
	if (iphone) {
		flink=flink + "<a class=\"videolink\" href='mediainventions_mp4play.php?id=" + videoid + "' title=\"" + videotitle + "\">";
	} else {
		flink=flink+"<a class=\"videolink\" href=\"mediainventions_flvplayer_AS3.swf?id=" + videoid + "\" onClick=\"return hs.htmlExpand(this, { objectType: 'swf', width: 580,";
		flink=flink+" objectWidth: 580, objectHeight: 345, maincontentText: 'You need to upgrade your Flash player',";
		flink=flink+"headingText: '"+videoheader+"', swfOptions: { version: '10', allowFullScreen: true, wmode: window }  } )\"";
		flink=flink+" class=\"highslide\" title=\"" + videotitle + "\">";
	}

	// add the link text
	flink=flink + videolinktext + "</span></a>";
	return flink;

}
*/
