// Flash ===================================

function FlashMain() {
  document.write('  <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="860" height="150">');
  document.write('    <param name="movie" value="/swf/jwg_top_2009.swf" />');
  document.write('    <param name="quality" value="high" />');
  document.write('    <embed src="/swf/jwg_top_2009.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="860" height="150"></embed>');
  document.write('  </object>');
}

// ChangeSiteImg ===================================
function siteimg(section_id, section_name, expressImg)
	{
	sectionName = 'SiteImg' + section_id;
	imgId = section_name + '_0' + expressImg;
	document.getElementById(sectionName).setAttribute('src', 'i/' + thisYear + '/' + imgId + '.jpg');
	}


// ChangeSiteImg ===================================
cnt = 0;

function ChangeImg(section_id, section_name, expressImg, url)
	{
	sectionName = 'SiteImg' + section_id;
	urlName = 'SiteLink' + section_id;

	imgId = section_name + '_0';
	imgId2 = imgId + expressImg;


	if(section_id == '9' && expressImg == '1') { // クロス・コーポレート＆コラボレーション部門 部門賞

		num = 4; // サイト数 + 1

		siteurl = new Array();
		siteurl[0] = ''
		siteurl[1] = 'http://www3.kao.co.jp/products/';
		siteurl[2] = 'http://www3.kao.co.jp/qa';
		siteurl[3] = 'http://www3.kao.co.jp/kajinavi';

		setInterval('Timer()',1000);

	} else if(section_id == '12' && expressImg == '1') { // 特別賞

		num = 3; // サイト数 + 1

		siteurl = new Array();
		siteurl[0] = ''
		siteurl[1] = 'http://panasonic.co.jp/ism/';
		siteurl[2] = 'http://panasonic.co.jp/cca/';

		setInterval('Timer()',1000);

	} else {

		document.getElementById(sectionName).setAttribute('src', 'i/' + thisYear + '/' + imgId2 + '.jpg');

		document.getElementById(urlName).href= url;
		}
	}




function Timer() {
	cnt %= num;
	if(cnt == 0) {
	setInterval('Timer()',0);
	}
	if(! cnt == 0) {
	document.getElementById(sectionName).setAttribute('src', 'i/' + thisYear + '/' + imgId2 + '_' + cnt + '.jpg');
	document.getElementById(urlName).href= siteurl[cnt];

	}
	cnt++;
}





// AddCookie ============================================
// Comment --------------------------------------------
function reWriteCookie(contents, url){

	var section_name = "selectsection";// クッキーの名前
	var contents_name = "selectcontents";
	var period = 7;// 有効期限日数


	// 有効期限の作成
	var nowtime = new Date().getTime();
	var clear_time = new Date(nowtime + (60 * 60 * 24 * 1000 * period));
	var expires = clear_time.toGMTString();

	// クッキーの発行（書き込み）
//	document.cookie = section_name + "=" + escape(section) + "; expires=" + expires;
	document.cookie = contents_name + "=" + escape(contents) + "; expires=" + expires;

		myurl = '/winners/' + thisYear + '/' + url + '.html';

		popup = window.open(myurl,"pop","width=635,height=720,scrollbars=yes,resizable=yes");

	if (popup != null)  {
		popup.focus();
	}
}

// aboutGrandprix --------------------------------------------
function aboutGrandprix(no){

	var aboutNo = "aboutThisSite";// クッキーの名前
	var contents_name = "aboutcontents";
	var period = 7;// 有効期限日数


	// 有効期限の作成
	var nowtime = new Date().getTime();
	var clear_time = new Date(nowtime + (60 * 60 * 24 * 1000 * period));
	var expires = clear_time.toGMTString();

	// クッキーの発行（書き込み）
	document.cookie = contents_name + "=" + escape(no) + "; expires=" + expires + "; path= /";

	location.href= "/about/index.html";


}


// writeAccordionPanel --------------------------------------------
function writeAccordionPanel(url, sectionId, no){

	var openPanel = sectionId;
	var period = 7;// 有効期限日数


	// 有効期限の作成
	var nowtime = new Date().getTime();
	var clear_time = new Date(nowtime + (60 * 60 * 24 * 1000 * period));
	var expires = clear_time.toGMTString();

	// クッキーの発行（書き込み）
	document.cookie = openPanel + "=" + escape(no) + "; expires=" + expires + "; path= /";

	location.href= url;
}


//ReadCookie ============================================
var exSection;
var exContents;

function ReadCookie(){
	var contents_name = "selectcontents";// クッキーの名前

	// 発行したクッキーの取得（読み込み）
	if (document.cookie) {
		var cookies = document.cookie.split("; ");
		for (var i = 0; i < cookies.length; i++) {
			var contents_str = cookies[i].split("=");
			if (contents_str[0] == contents_name) {
				var cookie_value = unescape(contents_str[1]);
				break;
			}
		}
	}

	exContents = contents_str[1]-1;

	var Accordion1 = new Spry.Widget.Accordion("Accordion1", { defaultPanel: exContents });

	return exContents;

}

// aboutSite --------------------------------------------
var exAbout;

function aboutSite(){
	var contents_name1 = "aboutcontents";// クッキーの名前

	// 発行したクッキーの取得（読み込み）
	if (document.cookie) {
		var cookies = document.cookie.split("; ");
		for (var i = 0; i < cookies.length; i++) {
			var contents_str1 = cookies[i].split("=");
			if (contents_str1[0] == contents_name1) {
				var cookie_value = unescape(contents_str1[1]);
//				break;
			}
		}
	}

	exAbout = cookie_value-1;

	var Accordion1 = new Spry.Widget.Accordion("Accordion1", { defaultPanel: exAbout });

	return exAbout;
}


// readAccordionPanel --------------------------------------------
var exSection;
function readAccordionPanel(sectionId){
	var openPanel = sectionId;// クッキーの名前

	// 発行したクッキーの取得（読み込み）
	if (document.cookie) {
		var cookies = document.cookie.split("; ");
		for (var i = 0; i < cookies.length; i++) {
			var contentsString = cookies[i].split("=");
			if (contentsString[0] == openPanel) {
				var cookie_value = unescape(contentsString[1]);
//				break;
			}
		}
	} else {
	cookie_value = 1;
	}

	exSection = cookie_value-1;

	var Accordion1 = new Spry.Widget.Accordion("Accordion1", { defaultPanel: exSection });

	return exSection;
}


// Jump Archive ===================================
function JumpArchive(selOBJ)
{
	n = selOBJ.selectedIndex;
	location.href = selOBJ.options[n].value;
}

// Popup page ===================================
function popup(myurl){
popupWin = window.open(myurl,"pop","width=635,height=720,scrollbars=yes,resizable=yes");
	if (popupWin != null)  {
		popupWin.focus();
	}
}
