//initialize here
YAHOO.util.Event.onDOMReady(init); 

var swfName = "altContent";

function init() {}

window.onload = function() {
	if(isIE){
		if(isIE && document.compatMode=="BackCompat"){
			document.body.onscroll = scrollHander;
		}else{
			document.documentElement.onscroll = scrollHander;
		}
	}
}

function scrollHander(){
	thisMovie(swfName).scrollHander(); 
}
	
function thisMovie(movieName) {
	if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	}else{
		return document[movieName];
	}
}

function setSwfFit(size){

	swffit.fit(swfName,size[0],size[1]);
}

//get window size
function GetWindowSize(type){
	if(type == "width,height"){
		return {width:GetWindowSize("width"), height:GetWindowSize("height")};
	
	}else if(type == "width"){
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			return window.innerWidth - 16;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			return document.documentElement.clientWidth;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			return document.body.clientWidth;
		}
	}else if(type == "height"){
		if( typeof( window.innerWidth ) == 'number' ) {
			//Non-IE
			return window.innerHeight;
		} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			//IE 6+ in 'standards compliant mode'
			return document.documentElement.clientHeight;
		} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			//IE 4 compatible
			return document.body.clientHeight;
		}
	}
}

function GetScrollY(){
	return document.documentElement.scrollTop || document.body.scrollTop;
}

//////////////////////////////////////


// ==================
// = Window Control =
// ==================
function focusWindow(name) {
	var w = window.open("", name);
	w.focus();
}
function openAndFocusWindow(url, name) {
	var w = window.open(url, name);
	w.focus();
}
function isIE() {
	var s = navigator.userAgent.toUpperCase().indexOf("MSIE") != -1;
	return s;
}
function isSafari() {
	var s = navigator.userAgent.toUpperCase().indexOf("SAFARI") != -1;
	return s;
}
function isFirefox() {
	var s = navigator.userAgent.toUpperCase().indexOf("FIREFOX") != -1;
	return s;
}
function safariOrFirefox() {
	var s = navigator.userAgent.toUpperCase().indexOf("SAFARI") != -1;
	var f = navigator.userAgent.toUpperCase().indexOf("FIREFOX") != -1;
	if(s || f) {
		return true;
	} else {
		return false;
	}
}

//////////////////////////////////////

function getBody(){
	if(isIE() || isFirefox()){
		return document.getElementsByTagName('html')[0];
	}else{
		return document.body;
	}
}

//scrolling
function scrollToTop(duration) {
	(new YAHOO.util.Scroll(getBody(), {scroll:{to:[0, 0]}}, duration, YAHOO.util.Easing.easeOutStrong)).animate();
}
function scrollTo(y, duration) {
	(new YAHOO.util.Scroll(getBody(), {scroll:{to:[0, y]}}, duration, YAHOO.util.Easing.easeOutStrong)).animate();
}


