function commitFlashObject(_obj, _container){
	_output=""
	_paramoutput=""
	_src=""
	_ver=""
	for(_cO in _obj){
		_output+=_cO+"=\""+_obj[_cO]+"\" "
		_paramoutput+="<param name="+_cO+" value=\""+_obj[_cO]+"\">";
		if(_cO=="movie")_src="src=\""+_obj[_cO]+"\"";
		if(_cO=="version")_ver=_obj[_cO];
	}
	if(_ver=="")_ver="8,0,0,0"
	ihtm="<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="+_ver+" "+_output+">\n"
	ihtm+=_paramoutput+"\n"
	ihtm+="<embed "+_src+" pluginspage=http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash type=application/x-shockwave-flash "+_output+">\n";
	ihtm+="</embed>\n";
	ihtm+="</object>\n";
	document.getElementById(_container).innerHTML=ihtm
}

function doFlash() {
	document.write('<object width="998" height="163" border="0">\n');
	document.write('<param name="movie" value="img/menu/head.swf">\n');
	document.write('<embed src="img/menu/head.swf" width="998" height="163"></object></td>\n');
}

function doFlash2 (flashWidth, flashHeight, flashName, myDiv, theURL) {
	var myFlash;
	theURL = new String(theURL)
	temp = theURL.split("&");
	theURL = temp[0];
	
	for(i = 1; i < temp.length; i++) {
		theURL += "%26" + temp[i];
	}
	
 	if (String(theURL) != "") {
		temp = theURL.split("<br>");
		if (temp.length == 1) {
			theURL = 'clickTAG=http://' + temp[0]
		}
		else {
			theURL = 'clickTAG=http://' + temp[0];
			for (clickNum = 1; clickNum <= temp.length; clickNum++) {
				 theURL += '&clickTAG' + clickNum + '=http://' + temp[clickNum-1]
			}
		}
	}

	myFlash = '<object classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version="8,0,0,0" quality="best" width="' + flashWidth + '" height="' + flashHeight + '">';
	myFlash += '<param name="FlashVars" value="' + theURL + '" />'
	myFlash += '<param name="movie" value="' + flashName + '">';
	myFlash += '<param name="quality" value="best">';
	myFlash += '<param name="width" value="' + flashWidth + '">';
	myFlash += '<param name="height" value="' + flashHeight + '">';
 	myFlash += '<param name="wmode" value="opaque" />';
	myFlash += '<embed src="' + flashName + '?' + theURL + '" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="opaque" quality="best" width="' + flashWidth + '" height="' + flashHeight + '">';
	myFlash += '</embed></object>';
	document.getElementById(myDiv).innerHTML = myFlash;
	//alert(myFlash);
}

function doQuicktime (qtWidth, qtHeight, qtName, myDiv, autoPlay) {
	var myQt;
	
	myQt = '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="' + qtWidth + '" height="' + (qtHeight + 20) + '">';
	myQt += '<param name="srv" value="' + qtName + '">';
	myQt += '<param name="autoplay" value="' + autoPlay + '">';
	myQt += '<param name="quality" value="best">';
	myQt += '<param name="type" alue="video/quicktime" width="' + qtWidth + '" height="' + (qtHeight + 20) + '">';
	myQt += '<embed src="' + qtName + '" pluginspage="http://www.apple.com/quicktime/download/" type="video/quicktime" src="'+ qtName + '" quality="best" width="' + qtWidth + '" height="' + (qtHeight + 20) + '" autoplay="' + autoPlay + '>';
	myQt += '</embed></object>';
	
	document.getElementById(myDiv).innerHTML = myQt;
}

function doyoutube (youTubeID, myDiv, videoWidth, videoHeight) {
	var myYT;
	var requiredMajorVersion = 10;
	var requiredMinorVersion = 0;
	var requiredRevision = 0;
	var theHeight, theWidth;
	
	var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
	
	if ((Number(videoHeight) < 50) || (String(videoHeight) == "undefined"))
		theHeight = 385;
	else
		theHeight = videoHeight;

	if ((Number(videoWidth) > 640) || (Number(videoWidth) < 50) || (String(videoWidth) == "undefined"))
		theWidth = 640;
	else
		theWidth = videoWidth;
	
	if (hasReqestedVersion) {
		myYT = '<center><object width="' + theWidth + '" height="' + theHeight + '">';
		myYT += '<param name="movie" value="http://www.youtube.com/v/' + youTubeID + '&ap=%2526fmt%3D18&fs=1&rel=0"></param>';
		myYT += '<param name="allowFullScreen" value="true"></param>';
		myYT += '<embed src="http://www.youtube.com/v/' + youTubeID + '&ap=%2526fmt%3D18&fs=1&rel=0" type="application/x-shockwave-flash" allowFullScreen="true" width="' + theWidth + '" height="' + theHeight + '">';
		myYT += '</embed>';
		myYT += '</object></center>';
	}
	else {
		myYT = '<br><center><b>Din browser mangler støtte for Flash, eller har en for gammel versjon av Flash installert.<br>Last ned nyeste versjonen av Flash her:<br>';
		myYT += '<a href="http://www.adobe.com/go/EN_US-H-GET-FLASH" target="_blank"><img border="0" src="http://www.adobe.com/images/shared/download_buttons/get_adobe_flash_player.png"></a></center><br>';
	}
	document.getElementById(myDiv).innerHTML = myYT;
}

var numTries = 0;

function checkControl (formName, fieldName, controlValue, keyValue) {
	var numAry = new Array("null", "en", "to", "tre", "fire", "fem", "seks", "syv", "åtte", "ni", "ti", "elleve", "tolv", "tretten", "fjorten", "femten", "seksten")
	theValue = (Number(controlValue) * 13) % Number(keyValue) + 7;
	if (theValue == Number(document.getElementById(fieldName).value)) {
		document.getElementById(formName).submit();
	}
	else if (String(numAry[theValue]) == String(document.getElementById(fieldName).value)) {
		document.getElementById(formName).submit();
	}
	else if (numTries < 2) {
		alert("Feil svar på kontrollspørsmålet. Vennligst prøv igjen.\nDu har " + (2 - numTries) + " forsøk igjen.")
	}
	else {
		alert("Feil svar på kontrollspørsmålet for tredje gang.\nDu vil nå bli sendt til forsiden av RELEASE.no og må evt. gå inn på denne siden igjen for å sende din forespørsel.");
		document.location.href = "default.asp";
	}
	numTries++;
}
	

