window.addEvent('domready', function() { 
	/* menu initialization */
	$('menuHome').addEvent('click', function(){ location.href = "?home"; });
	$('menuNews').addEvent('click', function(){ location.href = "?news"; });
	$('menuGameinfo').addEvent('click', function(){ location.href = "?gameinfo"; });
	$('menuMedia').addEvent('click', function(){ location.href = "?media"; });
	$('menuForum').addEvent('click', function(){ location.href = "/forum"; });
	
	themeCookie = Cookie.read("theme");

	initImageZoom();
	menu_shit();
	get_vars();
});

function get_vars(){ // Import GET Vars
   document.$_GET = [];
   var urlHalves = String(document.location).split('?');
   if(urlHalves[1]){
      var urlVars = urlHalves[1].split('&');
      for(var i=0; i<=(urlVars.length); i++){
         if(urlVars[i]){
            var urlVarPair = urlVars[i].split('=');
			if(urlVarPair[0] == 'gameinfo') {
				$('menuSub').setStyle('display', 'block');
				if(urlVarPair[1] == null) {
					var mySlide = new Fx.Slide('menuSub').hide().toggle().chain(function(){
						
					});
				}
			}
            document.$_GET[urlVarPair[0]] = urlVarPair[1];
         }
      }
   }
}

function theme_change() {
	Cookie.write('themeid', $('theme_select').get('value'), {duration: 90});
	
	if($('theme_select').get('value') == 1) { 
		new Asset.css('themes/default.css', {id: 'theme_default'});
		if($('theme_old')) { $('theme_old').dispose(); }
		if($('theme_xmas')) { $('theme_xmas').dispose(); }
	}
	if($('theme_select').get('value') == 2) { 
		new Asset.css('themes/old.css', {id: 'theme_old'});
		if($('theme_default')) { $('theme_default').dispose(); }
		if($('theme_xmas')) { $('theme_xmas').dispose(); }
	}
	
	if($('theme_select').get('value') == 3) { 
		snowStorm = new SnowStorm();
		snowStorm.start();
		new Asset.css('themes/xmas.css', {id: 'theme_xmas'});
		if($('theme_default')) { $('theme_default').dispose(); }
		if($('theme_old')) { $('theme_old').dispose(); }
	}
	
}
