/*
-------------------------------------
homeraresalon.com
:homerareSalon ver1
:produced 09.06.01
-------------------------------------
*/

var isMSIE = /*@cc_on!@*/false;

if(isMSIE){
	var gsTickerSwf_AN = "http://homeraresalon.com/homeraresalon_blogparts/homeSalon_ie.swf?";
	

}else {
	var gsTickerSwf_AN = "http://homeraresalon.com/homeraresalon_blogparts/homeSalon.swf?";
	
		
}


var gsTickerId_AN = "Ticker_AN";

// Tiker
MakeTicker_AN();

function MakeTicker_AN(){
	var sTickerUrl = gsTickerSwf_AN;
	
	var sHtml = "";
	sHtml += '<div id="blogpartsFla"><link rel="stylesheet" type="text/css" href="http://homeraresalon.com/homeraresalon_blogparts/salon.css"/>';
	sHtml += '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="160" height="410" id="' + gsTickerId_AN + '" align="middle">';
	sHtml += '<param name="allowScriptAccess" value="always" />';
	sHtml += '<param name="movie" value="' + sTickerUrl + '" />';
	sHtml += '<param name="quality" value="high" />';
	sHtml += '<param name="bgcolor" value="#ffffff" />';
	sHtml += '<embed src="' + sTickerUrl + '" quality="high" bgcolor="#ffffff" width="160" height="410" name="' + gsTickerId_AN + '" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	sHtml += '</object>';
//pr
sHtml += '<br><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="160" height="37" id="http://homeraresalon.com/homeraresalon_blogparts/pr.swf" align="middle">';
	sHtml += '<param name="allowScriptAccess" value="sameDomain" />';
	sHtml += '<param name="wmode" value="transparent" />';
	sHtml += '<param name="movie" value="http://homeraresalon.com/homeraresalon_blogparts/pr.swf" />';
	sHtml += '<param name="quality" value="high" />';
	sHtml += '<param name="bgcolor" value="#ffffff" />';
	sHtml += '<embed src="http://homeraresalon.com/homeraresalon_blogparts/pr.swf" quality="high" bgcolor="#ffffff" width="160" height="37" name="http://homeraresalon.com/homeraresalon_blogparts/pr.swf" align="middle" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
	sHtml += '</object></div>';
//	
	document.write(sHtml);
}


function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}



//
// getPageSize()
// Returns array with page width, height and window width, height
// Core code from - quirksmode.org
// Edit for Firefox by pHaez
//
function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}


//
// pause(numberMillis)
// Pauses code execution for specified time. Uses busy code, not good.
// Code from http://www.faqts.com/knowledge_base/view.phtml/aid/1602
//
function pause(numberMillis) {
	var now = new Date();
	var exitTime = now.getTime() + numberMillis;
	while (true) {
		now = new Date();
		if (now.getTime() > exitTime)
			return;
	}
}


function backToTop() {
	var x1 = x2 = x3 = 0;
	var y1 = y2 = y3 = 0;
	if (document.documentElement) {
		x1 = document.documentElement.scrollLeft || 0;
		y1 = document.documentElement.scrollTop || 0;
	}
	if (document.body) {
		x2 = document.body.scrollLeft || 0;
		y2 = document.body.scrollTop || 0;
	}
	x3 = window.scrollX || 0;
	y3 = window.scrollY || 0;
	var x = Math.max(x1, Math.max(x2, x3));
	var y = Math.max(y1, Math.max(y2, y3));
	window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));
	if (x > 0 || y > 0) {
		window.setTimeout("backToTop()", 10);
	}
}


function hiddenFlash(){
	$("object").css("visibility","hidden");
}

//cookieを保存(Flashより)
function setCookie(str) {
	document.cookie = ""+str+"; expires = Thu, 1-Jan-2030 00:00:00 GMT;"
	 }

//cookieを送信(Flashへ)
function getCookie() {
    var c = document.cookie
    return c;
    }

function showFlash(swf,v){
	document.getElementById("blogpartsFla").style.display = 'none'; 
	backToTop();
//	scrollTo(0,0); 
	var ver = v;
	var file = encodeURI(swf);
	//	heightBr = document.documentElement.clientHeight;




//stageHeight
engine = null;
if (window.navigator.appName == "Microsoft Internet Explorer")
	{if (document.documentMode) //IE8
	engine = document.documentMode;
	else{engine = 5; if (document.compatMode){if (document.compatMode == "CSS1Compat")engine = 7; }}
	//IE5
	if (engine == 5){heightBr = document.body.clientHeight}
	//IEnot5
	else{heightBr = document.documentElement.clientHeight}}
	//notIE
	else{heightBr = window.innerHeight}
//	






	strToSwf = file+'&abc='+heightBr;
	if(navigator.appName.indexOf("Microsoft") != -1){
		var br = "ie";
	}else{
		var br = "other";
	}
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();	
	var objBody = document.body;
	var objOverlay = document.createElement("div");
	var myTag= '<div id="homeSalon"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+ver+'" width="100%" height="100%" id="overlayFlash" align="middle"><param name="allowScriptAccess" value="always" /><param name="movie" value="'+strToSwf+'" /><param name="quality" value="high" /><param name="salign" value="lt" /><param name="bgcolor" value="#ffffff" /><param name="FlashVars" value="br='+br+'" /><embed src="'+strToSwf+'" quality="high" salign="lt" swLiveConnect=true bgcolor="#ffffff" FlashVars="br='+br+'" width="100%" height="100%" name="overlayFlash" id="overlayFlash" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object></div>';
	objOverlay.setAttribute('id','overlay');
//	objOverlay.onclick = function () {hideFlash(); return false;}
	objOverlay.style.display = 'block';
	objOverlay.style.position = 'absolute';
	objOverlay.style.top = '0';
	objOverlay.style.left = '0';
	objOverlay.style.zIndex = '10000';
 	objOverlay.style.width = '100%';
	objOverlay.style.height = (arrayPageSize[1] + 'px');
	objOverlay.innerHTML = myTag;
	objBody.insertBefore(objOverlay, objBody.firstChild);
//	window.document.overlayFlash.onclick = function () {hideFlash(); return false;}
	objOverlay.style.display = 'block';
}

function hideFlash(){
	var objBody = document.body;
	objBody.removeChild(objBody.firstChild);
	document.getElementById("blogpartsFla").style.display = 'block'; 
}


function initoverLayFlash(){
	if (!document.getElementsByTagName){ return; }
	
	var anchors = document.getElementsByTagName("a");

	// loop through all anchor tags
	for (var i=0; i<anchors.length; i++){
		var anchor = anchors[i];

		if (anchor.getAttribute("href") && (anchor.getAttribute("rel") == "overLayFlash")){
			anchor.onclick = function () {
				showFlash(this); 
				return false;
			}
		}
		
	}
	
}

//
// addLoadEvent()
// Adds event to window.onload without overwriting currently assigned onload functions.
// Function found at Simon Willison's weblog - http://simon.incutio.com/
//

function addLoadEvent(func)
{	
	var oldonload = window.onload;
	if (typeof window.onload != 'function'){
    	window.onload = func;
	} else {
		window.onload = function(){
		oldonload();
		func();
		}
	}

}

addLoadEvent(initoverLayFlash);	