<!--

addEvent(window, "load", parse_external_links);

// --------------------------------------------------------------------------------

function parse_external_links() { 
	if(!document.getElementsByTagName)	return; 
	var anchors	= document.getElementsByTagName("A"); 
	for(var i=0; i < anchors.length; i++){
		var anchor	= anchors[i]; 
		if(anchor.getAttribute("href") && anchor.getAttribute("rel")=="external"){
	 		anchor.target = "_blank"; 
	 	}
	}
}

// --------------------------------------------------------------------------------------------------

var ms_cookie_name	= "vypp_ms";
var music_state		= 1;

function save_music_state(state){
	var ms_value	= state;
	setCookie(ms_cookie_name, ms_value, 365);
}

function get_music_state(){
	var ms_value	= getCookie(ms_cookie_name);
	if(ms_value==0){
		music_state	= 0;
	}
	else{
		music_state	= 1;
	}
	return music_state;
}

// --------------------------------------------------------------------------------------------------

function launch_game_popup(game_name){
	
	var popup_width		= 600;
	var popup_height	= 500;
	
	var popup_left		= (screen.width - popup_width) / 2;
	var popup_top		= (screen.height - popup_height) / 2;
	
	window.open("/games.php?game=" + game_name, "", "scrollbars=no, width=" + popup_width + ", height=" + popup_height + ", left=" + popup_left + ", top=" + popup_top);
	
}

function launch_video_popup(video_name){
	
	var popup_width		= 320;
	var popup_height	= 256;
	
	var popup_left		= (screen.width - popup_width) / 2;
	var popup_top		= (screen.height - popup_height) / 2;
	
	window.open("/video.php?video=" + video_name, "", "scrollbars=no, width=" + popup_width + ", height=" + popup_height + ", left=" + popup_left + ", top=" + popup_top);
	
}

// --------------------------------------------------------------------------------------------------

function resize_window_onload(target){
	
	var window_size = ICJ_browserWindowSize();
	window.resizeBy(d(target).width - window_size['width'], d(target).height - window_size['height']);
	self.focus();
	
}

function ICJ_browserWindowSize(){
	
	var r = new Array();
	r['width'] = 0;
	r['height'] = 0;
	
	if(typeof(window.innerWidth) == 'number' ){
		//Non-IE
		r['width'] = window.innerWidth;
		r['height'] = window.innerHeight;
	} 
	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)){
		//IE 6+ in 'standards compliant mode'
		r['width'] = document.documentElement.clientWidth;
		r['height'] = document.documentElement.clientHeight;
	}
	else if(document.body && (document.body.clientWidth || document.body.clientHeight)){
		//IE 4 compatible
		r['width'] = document.body.clientWidth;
		r['height'] = document.body.clientHeight;
	}
	
	return r;
	
}

// --------------------------------------------------------------------------------------------------

function d(element){
	return document.getElementById(element);
}

function addEvent(obj, evType, fn){
	if(obj.addEventListener){
		obj.addEventListener(evType, fn, false);
		return true;
	}
	else if(obj.attachEvent){
		var r	= obj.attachEvent("on" + evType, fn);
		return r;
	}
	else {
		elm['on' + evType] = fn;
	}
}

function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ';', len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date	= new Date( today.getTime() + (expires) );
	var cookie_string	= name+'='+escape( value ) +
		( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
		( ( path ) ? ';path=' + path : '' ) +
		( ( domain ) ? ';domain=' + domain : '' ) +
		( ( secure ) ? ';secure' : '' );
	document.cookie	= cookie_string;
}

function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + '=' +
			( ( path ) ? ';path=' + path : '') +
			( ( domain ) ? ';domain=' + domain : '' ) +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}

// --------------------------------------------------------------------------------------------------

//-->