﻿function SendMessage(ObjectName,MessageName) {
    var cmd = "SendMessage" + " '" + ObjectName + "' " + "'" + MessageName + "' ";	
    var res = document.Virtools.DoCommand(cmd);
}

function SetName(ObjectName,AttributeName,Value){		
    var cmd = "SetAttribute" + " '"+ ObjectName + "' " + "'" + AttributeName + "' " + "'" + Value + "' ";		
    var res = document.Virtools.DoCommand(cmd);
} 

function GetCountry(ObjectName,AttributeName) {
		var cmd = "GetAttribute" + " '" + ObjectName + "' " + "'" + AttributeName + "' ";
	    var res = document.Virtools.DoCommand(cmd);
		oSelCountry = document.getElementById("country_box");
		countryOk = false
		if(oSelCountry)
		{
			for(x=0;x<oSelCountry.options.length;x++)
				{
					if(oSelCountry.options[x].value == res)
						{
							countryOk = true;
							break;
						}	
				}
		}
		if (countryOk) {
			document.getElementById(res).selected = 'selected';
		}
	}

function test_os()
	{
		if (is_macosx)
				{
					if (is_gecko || is_safari || is_ie4up)
					{
						SendMessage('Volume_frame','Mac');
					}
					else
					{
						alert('Your browser does not support 3D Life Player!\n Use Safari/Firefox/InternetExplorer');
					}
				}
			else
				{
					SendMessage('Volume_frame','PC');	
				}
	}
	

function ready() {
	GetCountry('Level','Country_ID');
	oSelCountry = document.getElementById("select_country");		
	if(oSelCountry)
		{
			oSelCountry.style.display = "block";
		}
	//alert('select_country auf block gesetzt');
}

function game() {
	document.getElementById('form_country').style.display = "none";
	SendMessage('Level','play');
	oSelCountry = document.getElementById("country_box");		
	if(oSelCountry)
		{
			var cou = document.getElementById('country_box').value;
		}
	
	SetName('Level','Country_ID',cou);
}

function game_cliff() {
	//var daten = '3/0/0/)3///)1///)3///)4///)0/234.51/509.51/0.586295)3///)3///)1///)1///)4///)0/249.29/449.29/0.63322)2///)3///)1///)3///)4///)0/139.96/439.96/0.630438)';
	var daten = '';
	document.all.Virtools.style.width = "640";
	document.all.Virtools.style.height = "480";
	document.getElementById('game').style.left = "-275";
	document.getElementById('game').style.top = "-138";
	//document.getElementById('select_replay').style.display = "none";
	SendMessage('Level','play');
	if (daten != '' && daten != '') {
		SetName('Level','Record',daten);
	}
}

function goBack() {
	
}

function checkExtern() {
	SetName('Level','Extern','Intern');
}

function Score() {
	document.getElementById('game').style.left = "-220";
	document.getElementById('game').style.top = "-24";
	document.Virtools.style.width = "640";
	document.Virtools.style.height = "220";
	//document.getElementById('Int_but_play').style.display = "block";
    $('#Int_but_play').show();
}

function play() {
	document.getElementById('game').style.left = "-220";
	document.getElementById('game').style.top = "-132";
	document.Virtools.style.width = "640";
	document.Virtools.style.height = "480";
}

function play_cliff() {
	document.getElementById('game').style.left = "-275";
	document.getElementById('game').style.top = "-138";
	document.Virtools.style.width = "640";
	document.Virtools.style.height = "480";
}

function newHighscore() {
	makeRequest('Highscore', 'highscore', Hswertung+'_0_25', 'iHTML', HsGid);
}

function accept() {
	true;
}

function Return(target) {
	SendMessage(target,'Play');
}

function Volume_plus() {
	if (document.Virtools != undefined) { SendMessage('Volume_frame','Volume_plus'); }
}

function Volume_minus() {
	if (document.Virtools != undefined) { SendMessage('Volume_frame','Volume_minus'); }
}

function Volume(vol) {
	setVolume(vol);
}

function setVolume(vol) { 
	/*if (vol == 0) {
		document.game_volume.src = 'images/volume_bg.jpg';
	}
	else {*/
		document.game_volume.src =  '/images/games/buttons/volume/' + vol + '/' + file +'.jpg';
	/*}*/
}

function fileLoad(url) {
	allowFullScreen = false;
	//alert(url);
	//UserComponentServer="81.223.4.42:18005";
	//UserComponentList="VirtoolsEncryptions.dll";
	//UserComponentMediaGroup="CustomDLL";
	divGame = document.getElementById('game');	
	divGame.innerHTML = Generate3DLifePlayerHtmlTag(url,200,70,'Virtools');
    //makeRequest('Startgame', 'serverrequest', '', 'iHTML');
}

function fileLoadCompCheck(url) {
	allowFullScreen = false;
	//alert(url);
	divGame = document.getElementById('game');	
	divGame.innerHTML = Generate3DLifePlayerHtmlTag(url,160,54,'Virtools');
    //makeRequest('Startgame', 'serverrequest', '', 'iHTML');
}

function checkType() {
	SetName('Level','Demotype',lang);
}

function popup(path,name,arg) {
	var winpath = path;
	var allarg = arg + ',resizable=no;scrollbars=no';
	window.open(winpath,name,allarg).focus();
}
function popupPic(path,name,arg) {
	var winpath = path;
	var allarg = arg + ',resizable=no;scrollbars=no';
	pop = window.open('',name,allarg);
	pop.document.open();
	pop.document.write('<html><head><title>3D-sport.com</title></head><body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">');
	pop.document.write('<img src="'+ path +'" border="0">');
	pop.document.write('</body></html>');
	pop.focus();
}
function score() {
	document.getElementById('help').style.display = 'none';
	document.getElementById('highscore').style.display = 'block';
}

function help() {
	document.getElementById('highscore').style.display = 'none';
	document.getElementById('help').style.display = 'block';
}

function loadVersion() {
	document.getElementById('game_load').style.display = 'block';
	document.getElementById('version').style.display = 'none';
}

function changeImages(id,url) {
	document.getElementById(id).src = url;
}

function writeJs(){
	

}
function Register(){
	document.location.href = "register.php";
}
	
