// @charset "shift_jis";
// JavaScript Document
localmode = false; //debug mode

site = '' + window.location.hostname;

if (site.indexOf('dev.') != -1) {
	chromeTransferURL="http://dev.disney.co.jp/tdr/redirect/?";
	chromeImgPath="http://dev.disney.co.jp/res710/images/chrome_tdr/";
} else if(site.indexOf('staging.') != -1 || site.indexOf('preview.') != -1) {
	chromeTransferURL="http://staging.disney.co.jp/tdr/redirect/?";
	chromeImgPath="http://staging.disney.co.jp/res710/images/chrome_tdr/";
} else {
	chromeTransferURL="http://www.disney.co.jp/tdr/redirect/?";
	chromeImgPath="http://www.disney.co.jp/res710/images/chrome_tdr/";
}

// local - force setting / START
if (localmode){
	chromeTransferURL="/tdr/redirect/?";
	chromeImgPath="/res710/images/chrome_tdr/";
}
// local - force setting / END

// Customized for Omniture - START //
var pageName='';
siteSection = '' + window.location;

siteSection = siteSection.substring(siteSection.indexOf(site) + site.length + 1, siteSection.length);
siteSection = siteSection.toLowerCase();

lastSlashPos = siteSection.lastIndexOf('/');
lastPeriodPos = siteSection.lastIndexOf('.');

if (lastPeriodPos > lastSlashPos) {
	pageName = siteSection.substring(lastSlashPos +1);
	siteSection = siteSection.substring(0,lastSlashPos)
} else {
	pageName = 'index.html';
	if (lastSlashPos ==siteSection.length -1) {
		siteSection = siteSection.substring(0,lastSlashPos);
	}
}

if (siteSection =='' || siteSection ==undefined ) {
	siteSection='tdr';
}

firstSlashPos =  siteSection.indexOf('/');
lastSlashPos = siteSection.lastIndexOf('/');

while (siteSection.indexOf('/') != -1) {
	siteSection = siteSection.replace('/',':');
}

args = 'site=' + site + '&siteSection=' + siteSection + '&pageName=' + pageName +'&type=custom';
// Customized for Omniture  - END //

function go(form) {
       var pages = form.to.selectedIndex;
	var newPage = null;

	if ( form.to.options[pages].value == "tdr_campaign" ) {
		tdr_campaign();
	} else if ( form.to.options[pages].value != "none" ) {
		newPage = isOpen(form.to.options[pages].value, "disney");
	}
};

function isOpen(url,name) {
	var Mac = ( navigator.appVersion.indexOf("PPC") != -1 || navigator.appVersion.indexOf("Macintosh") != -1)? true:false;
	var isIE = ( document.all )? true:false;

	if(!Mac || (Mac && !isIE)) return window.open(url,name);
	else return window.open(url,name,"menubar=yes,toolbar=yes,location=yes,directories=yes,status=yes,scrollbars=yes,resizable=yes");
};

function tdr_campaign() {
	window.open("http://www.tokyodisneyresort.co.jp/tdl/japanese/event/princess/campaign.html","tdr","menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,width=768,height=600");
};

/*
var chromeLinkText=new Array("映画/DVD","テレビ","ゲーム","ミュージック","ファミリー","パーク","ショッピング","モバイル","キャラクター","マイDisney","ダウンロード"); 
var chromeHomeHref="http://home.disney.co.jp/";
var chromeLinkHref=new Array("http://home.disney.co.jp/movies/","http://home.disney.co.jp/tv/","http://www.disneygames.jp/","http://home.disney.co.jp/music/","http://familytime.disney.co.jp/","http://home.disney.co.jp/park/","http://www.disney.co.jp/shopping/","http://home.disney.co.jp/mobile/","http://www.disney.co.jp/character/","http://home.disney.co.jp/foryou/","http://www.disney.co.jp/download/"); 
var chromeLinkNamePrefix="micro_chrome_tdr:";
var chromeHomeLinkName="home";
var chromeLinkName=new Array("movies","tv","games","music","family","park","shopping","mobile","characters","foryou","download"); 
*/

var chromeLinkText=new Array(
	"ゲーム",
	"ダウンロード",
	"キャラクター",
	"ファミリー",
	"映画&amp;DVD",
	"テレビ",
	"ミュージック",
	"ライブイベント",
	"パーク&amp;リゾート",
	"モバイル",
	"ショッピング",
	"ディズニー・カードクラブ",
	"マジックポイント・クラブ"
); 

var chromeHomeHref="http://www.disney.co.jp/";
var chromeLinkHref=new Array(
	"http://www.disneygames.jp/",
	"http://www.disney.co.jp/download/",
	"http://www.disney.co.jp/character/",
	"http://familytime.disney.co.jp/",
	"http://www.disney.co.jp/movies/",
	"http://www.disneychannel.jp/tvtop/",
	"http://www.disney.co.jp/music/",
	"http://www.disney.co.jp/liveevent/",
	"http://www.disney.co.jp/park/",
	"http://www.disney.co.jp/mobile/",
	"http://www.disney.co.jp/shopping/",
	"http://www.disneycardclub.jp/",
	"http://magic.disney.co.jp/"
); 
var chromeLinkNamePrefix="/Chrome - ";
var chromeHomeLinkName="home";
var chromeLinkName=new Array(
	"games",
	"download",
	"characters",
	"family",
	"movies",
	"tv",
	"music",
	"liveevent",
	"park",
	"mobile",
	"shopping",
	"dcc",
	"mpc"
); 



document.write('<table border="0" cellpadding="0" cellspacing="0" width="950" height="28">');
document.write('<form method="post" action="">');
document.write('<tr>');

// [1 - START]
//document.write('<td valign="top" rowspan="2"><a href="'+ chromeTransferURL +'http://home.disney.co.jp/" target="disney"><img src="' + chromeImgPath +'all_disneycojp_950.gif" width="109" height="26" border="0" alt="Disney.jp"></a></td>');

document.write('<td valign="top" rowspan="2">');
//document.write('<a href="'+ chromeTransferURL + chromeHomeHref + '" target="disney"  type="custom" name="' + chromeLinkNamePrefix + chromeHomeLinkName +'" onclick="cto.tracklink(this)">');
//document.write('<a href="'+ chromeTransferURL + argPrefix +'&name=' + chromeLinkNamePrefix + chromeHomeLinkName + '&href=' + chromeHomeHref + '" target="disney"  type="custom">');
document.write('<a href="'+ chromeTransferURL + 'href=' + chromeHomeHref + '&' + args +'&name=' + chromeLinkNamePrefix + chromeHomeLinkName + '" target="disney"  type="custom">');

document.write('<img src="' + chromeImgPath +'all_disneycojp_950.gif" width="109" height="26" border="0" alt="Disney.jp"></a></td>');
// [1 - END]

document.write('<td valign="top"><img src="'+ chromeImgPath + 'all_top_950.gif" width="841" height="3"></td>');
document.write('</tr>');
document.write('<tr><td valign="top">');
document.write('<table border="0" cellpadding="0" cellspacing="0" width="841">');
document.write('<tr>');
document.write('<td valign="top"><img src="'+ chromeImgPath + 'all_corner_950.gif" width="641" height="23"></td>');
document.write('<td background="'+ chromeImgPath + 'all_bg_950.gif" align="right" width="192">');

// [2 - START]
document.write('<select name="to" size="1" onChange="go(this.form)" style="height:23px">');
document.write('<option selected value="none" name="none">他のディズニーサイト</option>');

var optionMenus = '';
for(i=0;i<chromeLinkText.length;i++) {
	//optionMenus = optionMenus +'<option value="' + chromeTransferURL + argPrefix +'&name=' + chromeLinkNamePrefix + chromeLinkName[i]  + '&href=' + chromeLinkHref[i] + '">' + chromeLinkText[i] +'</option>';
	optionMenus = optionMenus +'<option value="' + chromeTransferURL + 'href=' + chromeLinkHref[i] + '&' + args +'&name=' + chromeLinkNamePrefix + chromeLinkName[i]  + '">' + chromeLinkText[i] +'</option>';
}
document.write(optionMenus);
// [2 - END]

document.write('</select>');
document.write('</td>');
document.write('<td valign="top"><img src="'+ chromeImgPath + 'all_bg_right_950.gif" width="8" height="23"></td>');
document.write('</tr>');
document.write('</table>');
document.write('</td></tr>');
document.write('<tr><td valign="top" colspan="2"><img src="'+ chromeImgPath + 'all_bottom_950.gif" width="950" height="2"></td></tr>');
document.write('</form>');
document.write('</table>');
