function changeColor( object, colorcode ) {
	object.style.color = colorcode;
}

function assignMovie() {

	var thumbs = $("dock").getElementsByTagName("div")[0].getElementsByTagName("a");
	if(thumbs) {
		for(var i=0; i<thumbs.length; i++ ) {
			var thumb = thumbs[i];
			thumb.num = i;
			thumb.pos = "thumb";
			thumb.onclick = changeFlashEv;
		}
	}

/*
	var news = document.getElementById("whatsnew").getElementsByTagName("a");
	if(news) {
		for(var i=0; i<news.length; i++ ) {
			var anews = news[i];
			anews.num = i;
			anews.pos = "news";
			anews.onclick = changeFlashEv;
		}
	}
	document.getElementById("dock").onmouseover = changeColorLightEv;
	document.getElementById("dock").onmouseout = changeColorDarkEv;
*/
}

function changeFlashEv( event ) {
	if ( movie[this.num] != "" ) {
		if ( playerOne == null ) {
			changeFlash(document.getElementById('main-viewer'), content_url + '/' + movie[this.num]);
		} else {
			//alert('/innerlink/'+ content_code + '/' + shop_code + '/no' + (this.num+1) + '/' + this.pos);
			pageTracker._trackPageview('/innerlink/'+ content_code + '/' + shop_code + '/no' + (this.num+1) + '/' + this.pos);
			changeFlash2(playerOne, 'http://movie.bigdesire.co.jp'+ content_url + '/' + movie[this.num]);
		}
	} else {
		pageTracker._trackPageview('/outgoing/'+ content_code + '/' + shop_code + '/thumb');
		openurl(hp_url,'','');
	}
	return false;
}

function changeColorLightEv( event ) {
	changeColor(document.getElementById('movie-text'),'#ccc');
}

function changeColorDarkEv( event ) {
	changeColor(document.getElementById('movie-text'),'#000');
}

function changeFlash2( obj, flash ) {
//	window.flashurl = flash;
	obj.setAutoPlay(true);
	obj.load(flash);
	obj.play();
	//obj.setVideoScaleMode("maintainAspectRatio");
}

function getWindowSize() {
	
	// IE以外
	if (!document.all && (document.layers || document.getElementById)) {
		width = window.innerWidth;
		height = window.innerHeight;
	}
	// ウィンドウズIE 6・標準モード
	else if (document.getElementById && (document.compatMode=='CSS1Compat')) {
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	}
	// その他のIE
	else if (document.all) {
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	}
	// その他(非対応)
	else {
		width = 1024;
		height = 800;
	}
	var sizes = [width, height];
	return sizes;
}

function changeSize(player, width, height) {
	player.setSize(width, height);
}

function showBigSizeFLV(bigObj,player,playerDiv,smallsize) {
	
	// 拡大ボタンを非表示
	bigObj.style.display = 'none';
		
	// ボックスを拡大
	var upperObj = document.getElementById("upper");
	upperObj.style.height = '497px';
	
	// 右ボックスを消去
	var rightObj = document.getElementById("upper-right");
	rightObj.style.display = 'none';
	
	// 縮小ボタンを表示
	var smallObj = document.getElementById(smallsize);
	smallObj.style.display = 'inline';

	width=570; height=472;
	
	// ムービーをリサイズ
//	var flvObj = document.getElementById(playerDiv);	
//	flvObj.style.zIndex = "150";
	changeSize(player, width, height);
	player.setVideoScaleMode("exactFit");
}

function showSmallSizeFLV(smallObj, player, playerDiv, bigsize) {

	
	// 縮小ボタンを非表示
	smallObj.style.display = 'none';
	
	// ボックスを縮小
	var upperObj = document.getElementById("upper");
	upperObj.style.height = '305px';
	
	// ムービーをリサイズ
	player.setVideoScaleMode("none");
	changeSize(player,480,320);
	
	// 拡大ボタンを表示
	var bigObj = document.getElementById(bigsize);
	bigObj.style.display = 'inline';
	
	// 右ボックスを表示
	var rightObj = document.getElementById("upper-right");
	rightObj.style.display = 'block';
}

function openurl(url){
	var ua = navigator.userAgent;
	if (ua.match(/MSIE (\d\.\d+)/)) {
		var agent = "IE" + RegExp.$1;
	}
	blankwindow = window.open('' ,'_blank');
	if ( agent == "IE6.0" || agent == "IE7.0") {
		blankwindow.document.write('<a href="' + url + '">' + url + '</a>');
		blankwindow.document.links[0].click();
	} else {
		blankwindow.document.location.replace(url);
	}
	blankwindow.focus();
}
