function init() {
	// Calculate swf_object left position
	swf_pos = $('content').cumulativeOffset();
	swf_pos = swf_pos[0];
	// Get document viewport size
	if(navigator.appName != 'Microsoft Internet Explorer') {
		viewport_width = document.viewport.getWidth();
	} else {
		viewp = getviewport();
		viewport_width = viewp[0];
	}
	if(viewport_width < 1259) {
	
		if(navigator.appName != 'Microsoft Internet Explorer') {
			diff_pos = 280 - swf_pos;
		} else {
			diff_pos = 400 - swf_pos;
			$('musthead').style.width = '720px';
			left__Pos = (viewport_width - $('musthead').getWidth()) / 2;
			d = (viewport_width == 1131) ? 100 : 0;
			//alert(viewport_width);
			$('musthead').style.marginLeft =  left__Pos  - d + 'px';
		}
		
		$('content').style.marginLeft = diff_pos + 'px';
		if(navigator.appName == 'Microsoft Internet Explorer') {
			$('content').style.paddingTop = '18px';
		}
		// Calculate swf_object left position
		swf_pos = $('content').cumulativeOffset();
		swf_pos = swf_pos[0];
	} 
	// Position swf_object and show it
	left_pos = (swf_pos - 220) / 2;
	$('swf_object').style.left = left_pos + 'px';
	$('swf_object').style.display = 'block';
	if(navigator.appName == 'Microsoft Internet Explorer') {
			$('content').style.paddingTop = '18px';
	}
}

function position_map() {
	var arrayWindowSize = getWindowSize();
	width = arrayWindowSize[0] / 2;
	map_width = $('harta').getWidth() / 2;
	map_left_pos = width - map_width;
	map_ini_pos = $('harta').cumulativeOffset();
	map_ini_pos = map_ini_pos[0];
	dif = map_left_pos - map_ini_pos;
	if(width < 600) {
		$('harta').style.marginLeft = dif + 120 + 'px';
		if(navigator.appName == 'Microsoft Internet Explorer') {
			//$('mapcontent').style.marginLeft = '300px';
			$('harta').style.width = '670px';
		} else {
			$('harta').style.width = '700px';
		}
	} else {
		$('harta').style.marginLeft = dif + 20 + 'px';
	}
}

function showgame() {
	var arrayPageSize = getPageSize();
	width = arrayPageSize[0];
	height = arrayPageSize[1];
	diff = 0;
	if(navigator.appName == 'Microsoft Internet Explorer') {
		diff = 4;
	} 
	$('dim_background').style.width = width + 'px';
	$('dim_background').style.height = height - diff + 'px';
	$('dim_background').style.display = 'block';
	var arrayWindowSize = getWindowSize();
	width = arrayWindowSize[0];
	height = arrayWindowSize[1];
	$('flash_game').style.left = (width / 2) - 350 + 'px';
	$('flash_game').style.top = (height / 2) - 250 + 'px';
	$('flash_game').style.display = 'block';
	var s1 = new SWFObject("swf/game.swf","ply","700","500","9","#FFFFFF");
	s1.addParam("allowfullscreen","true");
	s1.addParam("allowscriptaccess","always");
	s1.write("game_content");
	return false;
}

function hidegame() {
	$('dim_background').style.display = 'none';
	$('flash_game').style.display = 'none';
	$('game_content').innerHTML = '';
}

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

function getPageSize() {
        
    var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	return [pageWidth,pageHeight];
}

function getviewport() {
var viewportwidth;
 var viewportheight;
 
 // the more standards compliant browsers (mozilla/netscape/opera/IE7) use window.innerWidth and window.innerHeight
 
 if (typeof window.innerWidth != 'undefined')
 {
      viewportwidth = window.innerWidth,
      viewportheight = window.innerHeight
 }
 
// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

 else if (typeof document.documentElement != 'undefined'
     && typeof document.documentElement.clientWidth !=
     'undefined' && document.documentElement.clientWidth != 0)
 {
       viewportwidth = document.documentElement.clientWidth,
       viewportheight = document.documentElement.clientHeight
 }
 
 // older versions of IE
 
 else
 {
       viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
       viewportheight = document.getElementsByTagName('body')[0].clientHeight
 }
return [viewportwidth, viewportheight];
}
