/*
|-------------------------------------------------------
| Add Swf
|-------------------------------------------------------
| @container - player container(DIV)
| @swf - Player URL
| @w   - width of Player
| @h   - height of Player
| @id  - swf Object ID/Name
| @vars- variables send to player
*/
function swf(container, swf, w, h, id, vars)
{
	var randomnum = parseInt(1000*Math.random());
	var str = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"  id="'+id+'"';
	str +=' codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+w+'" height="'+h+'">';
	str +=' <param name="movie" value="'+swf+'?'+randomnum+'" />';
	str +=' <param name="quality" value="high" />';
	str +=' <param name="wmode" value="transparent" />';
	str +=' <param name="AllowScriptAccess" value="always">';
	str +=' <param name="FlashVars" value="'+vars+'" />';
	str +=' <embed src="'+swf+'?'+randomnum+'"';
	str +=' FlashVars="'+vars+'" wmode="transparent" allowfullscreen="true" quality="high"';
	str +=' AllowScriptAccess="always" name="'+id+'" ';
	str +=' pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash"';
	str +=' type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>';
	str +=' </object>';
	//document.write(str);	
	$('#'+container).html(str);
}


function myFlash(pp) {
	if (navigator.appName.indexOf ("Microsoft") !=-1) {
		return window[pp];
	} else {
		return document[pp];
	}
}


function bio(){
	myFlash('index').goBio();
}

function gallery()
{
	myFlash('index').goGallery();
}


function checkSize()
{
	window.onresize = function() {
		checkIT();		
	};
	window.onresize();
}
function checkIT()
{
	var w = $(window).width();
	var h = $(window).height();
 	w = w < 980 ? "980px" : "100%";
	h = h < 630 ? "630px" : "100%";
	$('#flashcontent').width(w);
	$('#flashcontent').height(h);		
}

function book(lang)
{
	$('#box_content a').click(function(){closeBox()});
	$('#box').click(function(){
		closeBox();		
	});
	showBg();
	h=630;
	if($(window).height()-40<h)
	{
		h = $(window).height()-40;	
	}
	
	showBox(850, h);
	$('#fr').attr("src", bookURL+'/'+lang);
	
}

function showBg()
{	
	$('#box').css('display', 'block');
	$('#box').css('opacity', 0);
	$('#box').width($(window).width());
	$('#box').height($(window).height());	
	$('#box').animate({opacity:.8},500);	
}

function showBox(w, h)
{
	var w1 = $(window).width();
	var h1 = $(window).height();
	$('#box_content').width(w);
	$('#box_content').height(h);
	$('#box_content div').height(h);
	$('#box_content').css('left', (w1-w)/2 + 'px');
	$('#box_content').css('top', '-800px');
	$('#box_content').fadeIn();	
	$('#box_content a').css('margin-left', w+'px');
	$('#box_content').animate({top: (h1-h)/3}, 500);
}

function closeBox()
{
	$('#box_content').fadeOut();
	$('#box').fadeOut();		
}

function career(lang)
{
	$('#box_content a').click(function(){closeBox()});
	$('#box').click(function(){
		closeBox();		
	});
	showBg();h=630;
	if($(window).height()-40<h)
	{
		h = $(window).height()-40;	
	}
	
	showBox(550, h);
	$('#fr').attr("src", careerURL+'/'+lang);	
}


function show_policies(str)
{
	
	$('#note_bg').css('display', 'block');
	$('#note_bg').css('opacity', 0);
	$('#note_bg').width($(window).width());
	$('#note_bg').height($(window).height());	
	$('#note_bg').animate({opacity:.8},500);	
	
	
	if(str=='')
	{
		$('#p1').css('display', 'block');	
		$('#p2').css('display', 'none');	
		$('#p3').css('display', 'none');	
	}else if(str=='_en'){		
		$('#p2').css('display', 'block');	
		$('#p1').css('display', 'none');	
		$('#p3').css('display', 'none');	
	}else{
		$('#p3').css('display', 'block');	
		$('#p2').css('display', 'none');	
		$('#p1').css('display', 'none');			
	}
	
	var w1 = $(window).width();
	var h1 = $(window).height();
	var h = $('#note').height();
	$('#note').css('left', (w1-400)/2 + 'px');
	$('#note').css('top', (h1-h)/3);
	$('#note').fadeIn();
	
	$('#note a').click(function(){closeNote()});
	$('#note_bg').click(function(){
		closeNote();		
	});	
}

function closeNote()
{
	$('#note').fadeOut();
	$('#note_bg').fadeOut();		
}

