var langDirectory = "en";


// SPECIAL SITE
function getAvailWidth ( ) {
	if ( screen.availWidth ) return screen.availWidth;
}
function getAvailHeight ( ) {
	if ( screen.availHeight ) return screen.availHeight;
}
function openSpecialSite( num ){
	if(num == 0){
		var src = "../special/" + langDirectory + "/index.html";
	}else{
		var src = "../../special/" + langDirectory + "/index.html";
	}
	var name = "D300S_SpecialSite"
	var options = "toolbar=no,location=no,status=no,menubar=no,scrollbars=yes,resizable=no"
	var width,height
	var minWidth = 1004
	var minHeight = 712
	var foceWidth = 1260
	var foceHeight = 780
	if(getAvailWidth()>minWidth){
		if(getAvailWidth()>foceWidth){
			width = foceWidth
		}else{
			width = getAvailWidth()
		}
	}else{
	width = getAvailWidth()
	}
	if(getAvailHeight()>minHeight){
		if(getAvailHeight()>foceHeight){
			height = foceHeight
		}else{
			height = getAvailHeight()
		}
	}else{
		height = getAvailHeight()
	}
	options += ",width="+width+",height="+height
	window.open(src,name,options);
	
}



function stageSize(){
	
	var agent = navigator.userAgent;
	var isSafari = agent.indexOf("Safari",0);
	
	var width,height
	var minWidth = 1004
	var minHeight = 712
	var foceWidth = 1260
	var foceHeight = 780
	if(getAvailWidth()>minWidth){
		if(getAvailWidth()>foceWidth){
			width = foceWidth
		}else{
			width = getAvailWidth()
		}
	}else{
	width = getAvailWidth()
	}
	if(getAvailHeight()>minHeight){
		if(getAvailHeight()>foceHeight){
			height = foceHeight
		}else{
			height = getAvailHeight()
		}
	}else{
		height = getAvailHeight()
	}
	
	setStageSize(width,height,isSafari);
}

function setStageSize(w,h,sf){
	selectMovie("index").setStageFunc(langDirectory,w,h,sf);
}




// D-MOVIE
function selectMovie(movieName){
	if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
}

function swfContact( id ){
	selectMovie("movie1").swfContactFunc(id);
	selectMovie("movie2").swfContactFunc(id);
	selectMovie("movie3").swfContactFunc(id);
	selectMovie("movie4").swfContactFunc(id);
}

function callJavascriptFunc(id){
	swfContact(id);
}
