var zooma = new Object();

zooma.validNumber = function(val) {
	return !( isNaN(val) || val=='' );
}

zooma.replaceChars = function(val, from, to) {
	var temp=val;
	for(var i=0;i<from.length;i++) {
		while(temp.indexOf(from[i])>-1) {
			temp = '' + temp.replace(from[i], to[i]);
		}
	}
	return temp;
}

zooma.trim = function(v) { 
	var strTmp = v; 
	while(strTmp.charAt(0)==" ") strTmp = strTmp.substr(1);  

	while(strTmp.charAt(strTmp.length-1)==" ") strTmp = strTmp.substr(0,strTmp.length-1); 
	return strTmp;
} 
zooma.currentRegion = function() {
	var strLanguage = zooma.currentPagePath.substr(0,zooma.currentPagePath.indexOf('/',1)+1);
	return strLanguage;
}

zooma.changeRegion = function() {
	var regsel = document.form1.selregionchooser;
	window.location.href=regsel.options[regsel.selectedIndex].value;
}

zooma.setRegionChooser = function() {
	var regsel = document.form1.selregionchooser;
	var curreg = zooma.currentRegion();
	for(var i=0;i<regsel.options.length;i++) {
		if(curreg==regsel.options[i].value)	{regsel.options[i].selected = true;break;}
	}
}

function renderMovie(src, width, height, autoplay, controller){
    if(src.indexOf(".mov")>-1) renderQT(src, width, height, autoplay, controller)
    else renderMP(src, width, height, autoplay, controller)
}
function renderQT(src, width, height, autoplay, controller){
    if(!width) width=320
    if(!height) height=240
    if(!controller) controller=false
    if(!autoplay) autoplay=true
    if(controller) height=height+16
 
    document.write( "<object classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\" bgcolor=\"black\" width=\""+width+"\"height=\""+height+"\" codebase=\"http:\/\/www.apple.com/qtactivex/qtplugin.cab\">" + 
    " <param name=\"SRC\" value=\""+src+"\">" + 
    " <param name=\"AUTOPLAY\" value=\""+autoplay+"\">" + 
    " <param name=\"CONTROLLER\" value=\""+controller+"\">" + 
    " <param name=\"BGCOLOR\" value=\"white\">" + 
    " <embed src=\""+src+"\" width=\""+width+"\" height=\""+height+"\" autoplay=\""+autoplay+"\" controller=\""+controller+"\" pluginspage=\"http:\/\/www.apple.com/quicktime/download/\"></embed>" + 
    "</object>");
}
 
 
function renderMP(src, width, height, autoplay, controller){
    if(!width) width=320
    if(!height) height=240
    if(!autoplay) autoplay=1
    else autoplay=0
 
    if(controller){
        height=height+48;
        controller=1
    }else controller=0
 
    document.write( "<object id=\"MediaPlayer\" autoplay=\""+autoplay+"\" width=\""+width+"\" height=\""+height+"\" classid=\"CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95\" codebase=\"http:\/\/activex.microsoft.com\/activex\/controls\/mplayer\/en/nsmp2inf.cab#Version=5,1,52,701\" standby=\"Loading Microsoft Windows Media Player components...\" type=\"application\/x-oleobject\">" + 
    "    <param name=\"src\" value=\""+src+"\">" + 
    "    <param name=\"ShowControls\" value=\""+controller+"\">" + 
    "    <param name=\"ShowDisplay\" value=\"0\">" + 
    " <embed type=\"application/x-mplayer2\" " + 
    "     src=\""+src+"\"" + 
    "     name=\"MediaPlayer\"" + 
    "     width=\""+width+"\"" + 
    "     height=\""+height+"\"" + 
    "  autoplay="+autoplay+"" + 
    "  showcontrols=\""+controller+"\"" + 
    "  showdisplay=\"0\"" + 
    "  >" + 
    "  </embed>" + 
    "</object>");
}