
function playVideo2(adsDataPath)
{
   var player=document.getElementById("extint");
   playVideo(player,adsDataPath);
}

function playVideo(player,adsDataPath){	
	var obj=new Object();
	obj.type="PlayerPlayItem";
	obj.adsDataPath=adsDataPath;
	player.CallToFlash(obj);
}

function OpenFullScreen(name)
{
  var fs = window.open( "_vhltest4fullscreen.htm?params&n="+name+"&config="+getURLParam("config","SmallConfig4.xml"),"FullScreenVideo", "toolbar=no,width=" + screen.availWidth  + ",height=" + screen.availHeight  + ",left=0,top=0,status=no,resizable=no,fullscreen=yes,scrollbars=no");
  if(fs!=null){
	fs.focus();
  }
}

function CloseFullScreen()
{
	window.self.close();
}
	
function OpenPopup(url){
  var fs = window.open(url,"PopupWindow", "width="+(screen.availWidth-300)+",height="+(screen.availHeight-300)+",left=150,top=100,location=yes,addressbar=yes,menubar=yes,toolbar=yes,status=yes,resizable=yes,scrollbars=yes");
  if(fs!=null){
	fs.focus();
  }
}

function _createVideoFlash(screenWidth,screenHeight,flashVar)
{
    var requiredMajorVersion = 8;
    var requiredMinorVersion = 0;
    var requiredRevision = 0;
    var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
               
    if (hasReqestedVersion) {
        AC_FL_RunContent(
				    "src", "VHLPlayer",
				    "width", screenWidth,
				    "height", screenHeight,
				    "align", "middle",
				    "id", "extint",
				    "menu", "false",
				    "quality", "high",
				    "wmode","transparent",//
				    "bgcolor", "#FFFFFF",
				    "name", "extint",
				    "allowScriptAccess","sameDomain",
				    "type", "application/x-shockwave-flash",
				    'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
				    "pluginspage", "http://www.adobe.com/go/getflashplayer",
				    "FlashVars",flashVar,
				    "targetNodeName","videocontent"
	    );
     }
}

function createVideoFlashFullMode()
{
   var     flashVar = "ConfigFile=DefaultConfig.xml&FullScreen=true&ConnectionName=" + getURLParam("n","notexist");
   var     screenWidth = "100%";
   var     screenHeight = "100%";   
   _createVideoFlash(screenWidth,screenHeight,flashVar);   
}

function createVideoFlashNormalMode(){

   var     flashVar = "ConfigFile=DefaultConfig.xml";
   var     screenWidth = "792";
   var     screenHeight= "389";   
   _createVideoFlash(screenWidth,screenHeight,flashVar);   

}

/*
function createVideoFlashNormalMode(){

    var requiredMajorVersion = 8;
    var requiredMinorVersion = 0;
    var requiredRevision = 0;
    var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
    
    var flashVar = "ConfigFile=" + getURLParam("config","SmallConfig4.xml");
    var screenWidth = "792";
    var screenHeight = "390";
    
    if ( screenMode > 0)
    {
        // set the full screen mode
        flashVar += "&FullScreen=true&ConnectionName=" + getURLParam("n","notexist");
        screenWidth = "100%";
        screenHeight = "100%";
     }   
    
    if (hasReqestedVersion) {
        AC_FL_RunContent(
				    "src", "VHLPlayer",
				    "width", screenWidth,
				    "height", screenHeight,
				    "align", "middle",
				    "id", "extint",
				    "quality", "high",
				    "bgcolor", "#FFFFFF",
				    "name", "extint",
				    "allowScriptAccess","sameDomain",
				    "type", "application/x-shockwave-flash",
				    'codebase', 'http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab',
				    "pluginspage", "http://www.adobe.com/go/getflashplayer",
				    "FlashVars",flashVar,
				    "wmode","transparent",
				    "targetNodeName","videocontent"
	    );
     } 
//     else 
//     {  // flash is too old or we can't detect the plugin
//	    var alternateContent = 'Alternate HTML content should be placed here.<BR>'
//	    + 'This content requires the Adobe Flash Player. '
//	    + '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
//	    document.write(alternateContent);  // insert non-flash content
//     }
}	
*/

function checkParam(str){
     if(str==null || typeof(str)!="string"){
         return false;
    }
  var bound=new Array("%","'","\"","<",">","/");
  for(var i=0;i<bound.length;i++){
	if(str.indexOf(bound[i])!=-1){
		return false;
	}
  }
  return true;
}

function getURLParam(strParamName,defaults){
    var strReturn = "";
    var strHref = window.location.href;
    if ( strHref.indexOf("&") > -1 ){
	    var strQueryString = strHref.substr(strHref.indexOf("&")).toLowerCase();
	    var aQueryString = strQueryString.split("&");
	    for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
	      if (aQueryString[iParam].indexOf(strParamName + "=") > -1 )
	        {
	        	var aParam = aQueryString[iParam].split("=");
		        strReturn = aParam[1];
				if(checkParam(strReturn)){
					return strReturn;
				}
	         }
	    }
    }
    return defaults;
}

    function FlashCallout(evtObj){              
        switch (evtObj.type){
            case "onPlayerInitComplete":
		        playVideo2('ski/skiAds2.xml');				
		        break;
        }
    }
