function get_window_size() {

	var width = 0, height = 0;
	
	if (typeof(window.innerWidth) == "number" ) {
		width = window.innerWidth;
		height = window.innerHeight;
	} 
	else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	} 
	else if (document.body && (document.body.clientWidth || document.body.clientHeight)) {
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	}
	
	return {
		"width": width,
		"height": height
	};

};

function adjust_cover() {

	var img_width = 1280;
	var img_height = 1024;

	var link_width = 300;
	var link_height = 133;

	var link_top = 403;
	var link_left = 244;

	var show_top = 810;

	var win_size = get_window_size();

	if (win_size.height < show_top) {

		var k = win_size.height / show_top;

		var new_img_width = Math.round(img_width * k);
		xx = Math.round((img_width - new_img_width) / 2);
		img_width = new_img_width;
		img_height = Math.round(img_height * k);

		$("cover").style.width = img_width + "px";
		$("cover").style.height = $("cover_container").style.height = img_height + "px";

		link_left = Math.round(link_left * k);
		link_top = Math.round(link_top * k);

		link_width = Math.round(link_width * k);
		link_height = Math.round(link_height * k);

		$("mainlink").style.width = link_width + "px";
		$("mainlink").style.height = link_height + "px";

		$("mainlink").style.left = link_left + "px";
		$("mainlink").style.top = link_top + "px";

	}

	var left_pos = Math.floor((win_size.width - img_width) / 2);

	$("cover").style.left = left_pos + "px";

	$("mainlink").style.left = (link_left + left_pos) + "px";

};

adjust_cover();
