/* 
Methods for resizing the flash stage at runtime.

setFlashWidth(divid, newW)
divid: id of the div containing the flash movie.
newW: new width for flash movie

setFlashWidth(divid, newH)
divid: id of the div containing the flash movie.
newH: new height for flash movie

setFlashSize(divid, newW, newH)
divid: id of the div containing the flash movie.
newW: new width for flash movie
newH: new height for flash movie

canResizeFlash()
returns true if browser supports resizing flash, false if not. 
*/
var flashSetWinHgt=null;
function setFlashWidth(divid, newW){
	document.getElementById(divid).style.width = newW+"px";
}
function setFlashHeight(divid, newH){
//alert(divid)
//alert(newH)
	var actHg=getWindowHeight();
	if(newH<actHg){
		
		document.getElementById(divid).style.height=actHg;
		
	}else{
		document.getElementById(divid).style.height = newH+"px";
		
	}
	flashSetWinHgt=newH;
}
function setFlashSize(divid, newW, newH){
	setFlashWidth(divid, newW);
	setFlashHeight(divid, newH);
}
function canResizeFlash(){
	var ua = navigator.userAgent.toLowerCase();
	var opera = ua.indexOf("opera");
	if( document.getElementById ){
		if(opera == -1) return true;
		else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
	}
	return false;
}
function resizeHtmlWin(){
	//alert(getWindowHeight());
	if(getWindowHeight()<flashSetWinHgt){
		return null;
	}
	document.getElementById('flashid').style.height=getWindowHeight();
}
function getWindowHeight() {
	var windowHeight=0;
	if (typeof(window.innerHeight)=='number') {
		windowHeight=window.innerHeight;
	}else{
		if (document.documentElement &&	document.documentElement.clientHeight){
		windowHeight=document.documentElement.clientHeight;
		}else{
			if (document.body&&document.body.clientHeight){
				windowHeight=document.body.clientHeight;
			}
		}
	}
	return windowHeight;
}
function openThreads(){
//	alert('open threads');
	//popIt("threads/index.html",'threads','900','600','yes');
	window.open("http://threads.fashionistas.be");
}
function popIt(mypage,myname,w,h,scrl){
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings ='height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scrl+',resizable=no';
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',location=1,menubar=1,status=1,toolbar=1';
	win = window.open(mypage,myname,settings);
	if(win.window.focus){
		win.window.focus();
	}
}
