/*
document.write("Browser CodeName: " + navigator.appCodeName);
document.write("<br /><br />");
document.write("Browser Name: " + navigator.appName);
document.write("<br /><br />");
document.write("Browser Version: " + navigator.appVersion);
document.write("<br /><br />");
document.write("Cookies Enabled: " + navigator.cookieEnabled);
document.write("<br /><br />");
document.write("Platform: " + navigator.platform);
document.write("<br /><br />");
document.write("User-agent header: " + navigator.userAgent);
if(true)
{
	s_w = window.document.body.clientWidth;
	s_h = window.document.body.clientHeight;
}
else
{
	s_w = window.innerWidth;
	s_h = window.innerHeight;
}

http://www.quirksmode.org/js/detect.html
*/

var saved_args = 600;


function getFlashMovie(movieName) {
  var isIE = navigator.appName.indexOf("Microsoft") != -1;
  return (isIE) ? window[movieName] : document[movieName];
}
	

function resizeFlash(w,h){
	
	
	
	$(window).scroll(function(){
		//alert($(window).scrollTop());
		getFlashMovie("main_fla").sendTextToFlash( $(window).scrollTop() + document.body.clientHeight);
	});
		
		
		
var s_w = document.body.clientWidth;
var s_h = document.body.clientHeight;

if(w <= 1)
	w = s_w;
if(h <= 1)
	h = s_h;

var wLimit = 1000;
var hLimit = 600;



	if(s_w < wLimit)
		window.document["main_fla"].setAttribute('width', wLimit + "px");
	else if (wLimit == s_w)
		window.document["main_fla"].setAttribute('width', "100%");
	else
		window.document["main_fla"].setAttribute('width', w + "px");
		
		
	if(s_h < hLimit)
		window.document["main_fla"].setAttribute('height', hLimit + "px");
	else if (hLimit == s_h)
		window.document["main_fla"].setAttribute('height', "100%");
	else
		window.document["main_fla"].setAttribute('height', h + "px");
		
		
	setHeight(saved_args);	
	
	
}





function setHeight(args){
	
	saved_args = args;
	
	var t_h = document.body.clientHeight;
	var t_w = document.body.clientWidth;
			if(parseInt(args)<t_h)
				window.document["main_fla"].setAttribute('height', '100%');
			else
				window.document["main_fla"].setAttribute('height', args);
			window.document["main_fla"].SetVariable('bdh', t_h);
			if(t_w>1000)
				window.document["main_fla"].setAttribute('width', '100%');
			else
				window.document["main_fla"].setAttribute('width', '1000px');
	
	getFlashMovie("main_fla").sendTextToFlash( $(window).scrollTop() + document.body.clientHeight);
	
	$(window).scrollTop($(document).height()); // for bottom scroll

}

