// Global Variable Declarations
ns4 = (document.layers)? true:false; // netscape 4?
ie4 = (document.all)? true:false; // internet explorer 4/5?
ns6 = (ns4|ie4)? false:true; // (Netscape 6)

var isLoaded=false;

var screen_top=(screen.height/2)-(500/2);
var screen_left=(screen.width/2)-(300/2);

// Image Functions

function image_swap(in_name,in_state) {
	if (!isLoaded) {
		return true;
	}
	document.images[in_name].src = eval(in_name + "_" + in_state + ".src");
}

// Popups

// Specific functions
function setPopupPosition(in_height,in_width) {
	screen_top=(screen.height/2)-(in_height/2);
	screen_left=(screen.width/2)-(in_width/2);
	if (screen_top<0) {
		screen_top=0;
	}
	if (screen_left<0) {
		screen_left=0;
	}
}

function blurDay() {
	if (document.forms[0].elements["BirthDay"].value=="") {
		document.forms[0].elements["BirthDay"].value="dd";
	}
}

function focusDay() {
	if (document.forms[0].elements["BirthDay"].value=="dd") {
		document.forms[0].elements["BirthDay"].value="";
	}
}

function blurYear() {
	if (document.forms[0].elements["BirthYear"].value=="") {
		document.forms[0].elements["BirthYear"].value="yyyy";
	}
}

function focusYear() {
	if (document.forms[0].elements["BirthYear"].value=="yyyy") {
		document.forms[0].elements["BirthYear"].value="";
	}
}

function submitCountryOnly() {
	document.forms[0].elements["SubmitContext"].value='CountryChange';
	document.forms[0].submit();
}

// Window openers
function openBinaryUpload(in_context) {
	setPopupPosition(430,370);
	popupWin = window.open(js_root + 'home/BinaryUpload.aspx?guid=' + in_context + '&ccode=' + js_countrycode + '&language=' + js_language,'binary','width=430,height=370');
}

function openContact() {
	contact_width=494;
	if (js_ismacie) {
		contact_width=478;
	}
	contact_height=550;
	setPopupPosition(contact_width,contact_height);
	popupWin = window.open(js_root + 'home/contact.aspx','contact','width=' + contact_width + ',height=' + contact_height + ',scrollbars=yes');
}

function openNewsletter() {
	setPopupPosition(495,550);
	popupWin = window.open(js_root + 'home/newsletter.aspx','newsletter','width=495,height=550,scrollbars=no');
}

function openRules() {
	setPopupPosition(495,550);
	popupWin = window.open(js_root + 'home/rules.aspx','rules','width=495,height=550,scrollbars=yes');
}

function openResponsibility() {
	news_width=494;
	if (js_ismacie) {
		news_width=478;
	}
	if (js_language=="dut") {
		news_width=news_width+100;
	}
	if (js_language=="dut_net") {
		news_width=news_width+100;
	}
	news_height=550;
	setPopupPosition(news_width,news_height);
	popupWin = window.open(js_root + 'home/responsibility.aspx','responsibility','width=' + news_width + ',height=' + news_height + ',scrollbars=yes');
}

function openSendToFriend() {
	setPopupPosition(494,550);
	popupWin = window.open(js_root + 'home/vote_sendfriend.aspx','sendfriend','width=494,height=550,scrollbars=yes');
}

// Global Init

function init() {
	splash_enter_off=new Image;
	splash_enter_off.src=js_root + "images/splash/splash_enter_off.gif";
	splash_enter_roll=new Image;
	splash_enter_roll.src=js_root + "images/splash/splash_enter_roll.gif";

	splash_exit_off=new Image;
	splash_exit_off.src=js_root + "images/splash/splash_exit_off.gif";
	splash_exit_roll=new Image;
	splash_exit_roll.src=js_root + "images/splash/splash_exit_roll.gif";

	close_off=new Image;
	close_off.src=js_root + "images/common/close_off_" + js_language + ".gif";
	close_roll=new Image;
	close_roll.src=js_root + "images/common/close_roll_" + js_language + ".gif";

	submit_button_off=new Image;
	submit_button_off.src=js_root + "images/common/submit_off_" + js_language + ".gif";
	submit_button_roll=new Image;
	submit_button_roll.src=js_root + "images/common/submit_roll_" + js_language + ".gif";
	
	upload_button_off=new Image;
	upload_button_off.src=js_root + "images/content/upload_button_off_" + js_language + ".gif";
	upload_button_roll=new Image;
	upload_button_roll.src=js_root + "images/content/upload_button_roll_" + js_language + ".gif";
	
	isLoaded=true;
}

