var css_counter = 0;
$(function(){
	if(COOKIE['css_counter']){
		css_counter = COOKIE['css_counter'];
	}
	var window_width = $(window).width();
if(window_width < 960){
	window_width=960;
}
	var left_position = ( window_width - 1920) / 2;
	$('#headFlash,#footFlash').css('text-indent',left_position);
	$('#headFlash,#footFlash').css('width',window_width);
	$('body').addClass('bg'+css_counter);
	setFlash('headFlash','headFlash',1920,70);
	setFlash('footFlash','footFlash',1920,70);
	$('#footFlash').parent().css('height','70px');
	$('#footFlash').parent().parent().css('height','70px');
	setFlash('downLight','downLight',824,80);
	setFlash('resite','resite',110 ,180);
	var hoge_height = $(window).height()-$('.footer').height()-100-70;
	$('#hoge').height(hoge_height);
	$(window).resize(function(){
		var hoge_height = $(window).height()-$('.footer').height()-100-70;
		$('#hoge').height(hoge_height);
		var window_width = $(window).width();
if(window_width < 960){
	window_width=960;
}
		var left_position = ( window_width - 1920) / 2;
		$('#headFlash,#footFlash').css('text-indent',left_position);
		$('#headFlash,#footFlash').css('width',window_width);
	});
});
function divBgChanger(){
	$('#_overlay').css('background-color',"#FFFFFF");
	return 1;
}
function setFlash(file_name,target_id,width,height){
	var dateObject = new Date();
	dateObject *= 1;
	var html ='<span><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+width+'" height="'+height+'"  id="aexternal">';
	html +=   '<param name="movie" value="/swf/'+ file_name + '.swf?changeId='+css_counter+'">';
	html +=   '<param name="quality" value="high">';
	html +=   '<param name="wmode" value="transparent">';
	html +=   "<param name='allowScriptAccess' value='always' />\n";
	html +=   '<param name="menu" value="0">';
	html +=   '<param name="changeId" value="'+css_counter+'">';
	html +=   '<parama name="wmode" value="transparent">';
	html +=   '<embed wmode="transparent" src="/swf/'+ file_name + '.swf?changeId='+css_counter+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'" wmode="transparent"  allowScriptAccess="always" ></embed></object></span>';
	$('#'+target_id).html(html);
}
var cssChanger = function(){
	$('body').removeClass('bg'+css_counter);
	css_counter++;
	css_counter = css_counter % 2;
	$('body').addClass('bg'+css_counter);
	setFlash('resite','resite',110 ,180);
	setFlash('headFlash','headFlash',1920,70);
	setFlash('footFlash','footFlash',1920,700);
	$('#footFlash').parent().css('height','70px');
	$('#footFlash').parent().parent().css('height','70px');
	$('#_overlay').animate({opacity: 0},1000,function(){$('#_overlay').remove();});
	setCookie('css_counter',css_counter,'outward.jp','/',30,0);
}
function resiteStart(){
	if($(window).width() < 960){
		var window_width = 960;
	}else{
		var window_width = $(window).width();
		
	}
	var left_position = ( window_width- 1664) / 2;
	var overlayObj = $(document.createElement('div'));
	overlayObj.attr('id','_overlay');
	overlayObj.css('position','absolute');
	overlayObj.css('z-index','110');
	overlayObj.css('text-align','center');
	if (left_position < 0){
			overlayObj.css('text-indent',left_position);
	}
	overlayObj.width('100%');
	overlayObj.height('100%');
	overlayObj.append('<span id="jsCall" style=""></span>');
	$('body').prepend(overlayObj);

	setFlash('jsCall','jsCall',1664,889,css_counter);
	$('#headFlash').html('');
	$('#footFlash').html('');
}

