//	--------------------------------------------------------------------------------------//
//		Setup
//	--------------------------------------------------------------------------------------//
var domain = 'http://www.ficc.jp/';
var contentsRoot = domain+'woman/common/';
//		Import
document.write('<script type="text/javascript" src="common/js/JavaScriptFlashGateway.js"></script>');
document.write('<script type="text/javascript" src="common/js/swfobject.js"></script>');

//----------------------------------------------------------------------------------------------------------------------------------------------------------------//
//		womanEmbedForm JS
//----------------------------------------------------------------------------------------------------------------------------------------------------------------//
var womanEmbedFormObject = new Object();
//----------------------------------------------------------------------------------------------------------------------------------------------------------------//
//		INIT
//----------------------------------------------------------------------------------------------------------------------------------------------------------------//
function womanEmbedFormInit(_productsName,_productsID){	
	womanEmbedFormObject.otherSwfContainerList = new Array();
	womanEmbedFormObject.bNotResize = false;
	womanEmbedFormObject.contentsRoot = contentsRoot;
	womanEmbedFormObject.pdfRoot = domain+'collection/pdf/'+_productsName+'/';
	
	womanEmbedFormObject.pxyBlogParts = "blogparts";
	womanEmbedFormObject.bIE = /*@cc_on!@*/false;
	womanEmbedFormObject.ua = 	navigator.userAgent;
	womanEmbedFormObject.bSafari = (womanEmbedFormObject.ua.indexOf("Safari")!=-1);
	if(womanEmbedFormObject.ua.indexOf("Windows") > -1){
		womanEmbedFormObject.bWin = true;
	}
	if (womanEmbedFormObject.ua.match(/Gecko/)) {
		if (womanEmbedFormObject.ua.match(/(Firebird|Firefox)\/([\.\d]+)/)) {
			womanEmbedFormObject.bFoxy = true;
		}
	}
	if(window.opera){
		womanEmbedFormObject.bOpera = true;
	}
	if (womanEmbedFormObject.bIE && typeof document.body.style.maxHeight != "undefined") {
		womanEmbedFormObject.bIE7 = true;
	}
	womanEmbedFormObject.body = document["CSS1Compat" == document.compatMode ? "documentElement":"body"];	
	var uidwomanEmbedFormMain = "uidwomanEmbedFormMain";
	//	-----------------------------------------------------------------------------------------------------------------------------------------------------------//
	//		ATTACH MAIN SWF
	//	-----------------------------------------------------------------------------------------------------------------------------------------------------------//	
	womanEmbedFormObject.attachFullscreen = function(){
		mainContainer = document.createElement("div");
		mainContainer.setAttribute("id","tagheuer_products_main");
		mainContainer.style.zIndex = "10001";
		mainContainer.style.position = "absolute";
		mainContainer.style.width = this.getWidth() + "px";
		mainContainer.style.height = this.getHeight() + "px";
		document.body.appendChild(mainContainer);
		var soMain = new SWFObject('swf/code_paste.swf', 'preloader', '100%', '100%', '8', '#FFFFFF');
		soMain.addParam("allowScriptAccess", "always");

		soMain.addVariable("contentsRoot", womanEmbedFormObject.contentsRoot);
		soMain.addVariable("pdfRoot", womanEmbedFormObject.pdfRoot);
		soMain.addVariable("lcId", uidwomanEmbedFormMain);
		soMain.addVariable("productsName", _productsName);
		soMain.addVariable("productsID", _productsID);
		mainContainer.innerHTML = soMain.getSWFHTML();
		this.replaceResize();

	}

	womanEmbedFormObject.removeMain = function(){
		var mainContainer = document.getElementById('tagheuer_products_main');
		while(mainContainer.firstChild){
			mainContainer.removeChild(mainContainer.firstChild);
		}
		document.body.removeChild(mainContainer);
	}	
	//	-----------------------------------------------------------------------------------------------------------------------------------------------------------//
	//		IN/VISIBLE OTHER OBJECT
	//	-----------------------------------------------------------------------------------------------------------------------------------------------------------//
	womanEmbedFormObject.hideOther = function(){
		this.hideOtherObject(document.getElementsByTagName('object'));
		this.hideOtherObject(document.getElementsByTagName('embed'));
		this.hideOtherObject(document.getElementsByTagName('select'));
		this.hideOtherObject(document.getElementsByTagName('iframe'));	
	}
	//	-----------------------------------------------------------------------------------------------------------------------------------------------------------//
	//		INVISIBLE OTHER OBJECT
	//	-----------------------------------------------------------------------------------------------------------------------------------------------------------//
	womanEmbedFormObject.hideOtherObject = function(_arg){
		var tmpList = _arg.length;
		for( var i=0; i<tmpList; i++ ){
			if( _arg[i].style.visibility != 'hidden' ){
					womanEmbedFormObject.otherSwfContainerList.push(_arg[i]);
					_arg[i].style.visibility='hidden';
				
			}
		}		
	}
	//	-----------------------------------------------------------------------------------------------------------------------------------------------------------//
	//		INVISIBLE OTHER OBJECT
	//	-----------------------------------------------------------------------------------------------------------------------------------------------------------//
	womanEmbedFormObject.respawnOtherObject = function(){
		for( var i=0; i<womanEmbedFormObject.otherSwfContainerList.length; i++ ){
			womanEmbedFormObject.otherSwfContainerList[i].style.visibility = 'visible';
		}
	}	
	//----------------------------------------------------------------------------------------------------------------------------------------------------------------//
	//		get Scroll / Size
	//----------------------------------------------------------------------------------------------------------------------------------------------------------------//
	womanEmbedFormObject.getScrollX = function(){
		var returnVal;
		if(this.bOpera){
			returnVal = window.pageXOffset;
		}else if(document.all && document.getElementById && (document.compatMode == 'CSS1Compat')){
			returnVal = document.documentElement.scrollLeft;
		}else if(document.all){
			returnVal = document.body.scrollLeft;
		}else if(!document.all && (document.layers || document.getElementById)){
			returnVal = window.pageXOffset;
		}
		return returnVal;
	}
	
	womanEmbedFormObject.getScrollY = function(){
		var returnVal;
		if(this.bOpera){
			returnVal = window.pageYOffset;
		}else if(document.all && document.getElementById && (document.compatMode == 'CSS1Compat')){
			returnVal = document.documentElement.scrollTop;
		}else if(document.all){
			returnVal = document.body.scrollTop;
		}else if(!document.all && (document.layers || document.getElementById)){
			returnVal = window.pageYOffset;
		}
		return returnVal;
	}
	
	womanEmbedFormObject.getWidth = function(){
		var returnVal;
		if(this.bOpera){
			returnVal = document.body.clientWidth;
		}else if(womanEmbedFormObject.bSafari){
			returnVal = document.body.clientWidth+24;
		}else if(document.all && document.getElementById && (document.compatMode == 'CSS1Compat')){
			returnVal = document.documentElement.clientWidth;
		}else if(document.all){
			returnVal = document.body.clientWidth;
		}else if(!document.all && (document.layers || document.getElementById)){
			returnVal = window.womanEmbedFormObject.body.clientWidth;
		}
		return returnVal;
	}
	
	
	womanEmbedFormObject.getHeight = function(){
		var returnVal;
		if(this.bOpera){
			returnVal = document.body.clientHeight;
		}else if(document.all && document.getElementById && (document.compatMode == 'CSS1Compat')){
			returnVal = document.documentElement.clientHeight;
		}else if(document.all){
			returnVal = document.body.clientHeight;
		}else if(!document.all && (document.layers || document.getElementById)){
			returnVal = window.innerHeight;
		}
		return returnVal;
	}
	
	//----------------------------------------------------------------------------------------------------------------------------------------------------------------//
	//		set Replace / Resize
	//----------------------------------------------------------------------------------------------------------------------------------------------------------------//
	womanEmbedFormObject.replaceResize = function(){
		var mainContainer = document.getElementById("tagheuer_products_main");
		if(mainContainer && !this.bNotResize){	
			mainContainer.style.top = this.getScrollY()+"px";
			mainContainer.style.left = this.getScrollX()+"px";
			mainContainer.style.width = this.getWidth()+"px";
			mainContainer.style.height = this.getHeight()+"px";
		}
	}
	//	-----------------------------------------------------------------------------------------------------------------------------------------------------------//
	//		WINDOW EVENTS
	//	-----------------------------------------------------------------------------------------------------------------------------------------------------------//
		if (window.addEventListener) window.addEventListener("resize",womanEmbedFormResize,false);
		if (window.attachEvent) window.attachEvent("onresize",womanEmbedFormResize);
		if (window.addEventListener) window.addEventListener("scroll",womanEmbedFormResize,false);
		if (window.attachEvent) window.attachEvent("onscroll",womanEmbedFormResize);
}

function womanEmbedFormResize(){
	womanEmbedFormObject.replaceResize();
}
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
//		F2JS	
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
function womanEmbedFormFullscreenOpen(_productsName,_productsID){
	womanEmbedFormInit(_productsName,_productsID);
	womanEmbedFormObject.orginalOverHidden = womanEmbedFormObject.body.style.overflow;
	womanEmbedFormObject.hideOther();
	womanEmbedFormObject.attachFullscreen();
}

function womanEmbedFormFullscreenClose(){
	womanEmbedFormObject.removeMain();
	womanEmbedFormObject.respawnOtherObject();
	womanEmbedFormObject.body.style.overflow = womanEmbedFormObject.orginalOverHidden;
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
//		ADDED ON 2007/11/19	
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~//
var searchVal = document.location.search.substring(1,document.location.search.length);
function womanEmbedFormFullscreenAutoOpen(){
	if(document.URL.indexOf("#player_code",0)>=0){
		womanEmbedFormFullscreenOpen('');
	}
}
