// set required video variables //
var hgt=window.mktvidhgt;
var prp=window.mktvidprp;
var dmn=window.mktviddmn;
var src='http://www.fccinteractive.com/widgets/mktvideo_v3/mktvideo_v3.cfm';

// check to make sure the property id is defined and is a numeric value
// append the marketplace property value to the end of the video_url variable
if((prp == undefined) || (isNaN(parseInt(prp)))){ prp=1; }
src=src+'?prp='+prp;

// if hgt is not defined or is not a number, set default height to 60
// check the height so it isn't too big - if larger than 200, set it to 200
// append the value to the end of the src variable
if((hgt == undefined) || (isNaN(parseInt(hgt)))){ hgt=60; }
if(hgt > 200){ hgt=200; }
src=src+'&hgt='+hgt;

// if dmn is defined, check it to make sure it is a legit url
// if legit, append the value to the src variable
if(dmn != ''){
	urlpattern = /^[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/;
	if(!urlpattern.test(dmn)){
		dmn='';
	}
	else{
		src=src+'&dmn='+dmn;
	}
}

// if marketplace loc_marketids are defined, append the value to the src variable 
if(window.mktvidids){
	src=src+'&ids='+mktvidids;
}

// if marketplace tags are defined, append the value to the src variable
if(window.mktvidtag){
	src=src+'&tag='+mktvidtag;
}

// and add a default of 260 to the frame height for the video player
var frmhgt=298+Number(hgt); 

// create iframe with the video_url //
document.write('<iframe' +
             ' name="videoplayer_frame"' +
             ' width="300"' +
			 ' height="' + frmhgt + '"'+
             ' frameborder=0' +
             ' src="' + src + '"'+
             ' marginwidth="0"' +
             ' marginheight="0"' +
             ' vspace="0"' +
             ' hspace="0"' +
             ' allowtransparency="true"' +
             ' scrolling="no"></iframe>');

