
function init_soon () {
	//alert ( 'init_soon ()' );
	set_bleed ();
	// ---	embed the flash movie
	// swfobject.embedSWF(swfUrl, id, width, height, version, expressInstallSwfurl, flashvars, params, attributes);
	var vars = {
		file: "/swf/soon_slides.xml", 
		width: bleed_w, 
		height: bleed_h, 
		showicons: "false", 
		overstretch: "true", 
		transition: "fade", 
		shownavigation: "false", 
		shuffle: "false"
	};
	var params = {
		menu: "false", 
		wmode: "transparent"
	};
	swfobject.embedSWF ( "/swf/imagerotator.swf", "bleed", bleed_w, bleed_h, "1", "", vars, params );
	parse_links ();
}

var bleed_w, bleed_h;
function set_bleed () {
	//alert ( 'set_bleed ()' );
	var o_img 		= document.getElementById ( 'bleed_img' );
	var img_w 		= o_img.offsetWidth;
	var img_h 		= o_img.offsetHeight;
	
	var o_bleed 	= document.getElementById ( 'bleed' );
	bleed_w 		= document.body.offsetWidth +20;
	bleed_h 		= document.body.offsetHeight 
					-document.getElementById ( 'topnav' ).offsetHeight 
					-document.getElementById ( 'footer' ).offsetHeight
					+20
					;
	o_bleed.style.height 	= bleed_h + "px";
	
	var img_ratio 	= img_h / img_w;
	var new_h 		= Math.ceil ( bleed_w * img_ratio );
	var new_x 		= 0;
	var new_y 		= 0;
	if ( bleed_h > new_h ) {
		// ---	set the image to bleed horizontally
		img_ratio 	= img_w / img_h;
		o_img.style.width 	= Math.ceil ( bleed_h * img_ratio ) + "px";
		o_img.style.height 	= bleed_h + "px";
		// ---	center align
		var new_x 	= Math.ceil ( - ( ( o_img.offsetWidth - o_bleed.offsetWidth ) /2 ) );
	} else {
		// ---	set the image to bleed vertically
		o_img.style.width 	= bleed_w + "px";
		o_img.style.height 	= new_h + "px";
		// ---	middle align
		var new_y 	= Math.ceil ( - ( ( o_img.offsetHeight - bleed_h ) /2 ) );
		}
	o_img.style.marginLeft 	= new_x + "px";
	o_img.style.marginTop 	= new_y + "px";
	o_img.style.visibility 	= "visible";
}
function parse_links () {
	// ---	cycle all document links
	for ( i = 0;  i < document.links.length;  i++ ) {
		currHref 	= document.links[ i ].href;
		currText 	= document.links[ i ].innerHTML;
		if ( currHref && currHref.indexOf ( "[[" ) != -1 ) 	document.links[ i ].href 		= parse_eml ( currHref );
		if ( currText && currText.indexOf ( "[[" ) != -1 ) 	document.links[ i ].innerHTML 	= parse_eml ( currText );
	}
}
function parse_eml ( str ) {
	posBegin 	= str.indexOf ( "[[" );
	posEnd 		= str.indexOf ( "]]" );
	strBegin 	= str.substr ( 0, posBegin );
	strEnd 		= str.substr ( posEnd +2 );
	strParse 	= str.substr ( ( posBegin +2 ), ( posEnd - ( posBegin +2 ) ) );
	arrParse 	= strParse.split ( "," );
	strEml 		= strBegin + arrParse[ 2 ] + "@" + arrParse[ 1 ] + "." + arrParse[ 0 ] + strEnd;
	return strEml;
}

var vid_win 	= 0;
function vid_pop ( url ) {
	/*
	if ( vid_win ) {
		if ( !vid_win.closed ) vid_win.close();
	}
	*/
	var vw_w 	= 400;
	var vw_h 	= 400;
	var vw_x 	= ( screen.width /2 ) - ( vw_w /2 );
	var vw_y 	= ( screen.height /2 ) - ( vw_h /2 );
	var vw_attr 	=  'toolbar=no'
					+ ',location=no'
					+ ',directories=no'
					+ ',status=no'
					+ ',menubar=no'
					+ ',scrollbars=no'
					+ ',resizable=no'
					+ ',copyhistory=yes'
					+ ',width=' + vw_w
					+ ',height=' + vw_h
					+ ',left=' + vw_x
					+ ',top=' + vw_y
					+ ',screenX=' + vw_x
					+ ',screenY=' + vw_y
					;
	vid_win 	= window.open ( url, 'vid_win', vw_attr );
	setTimeout ( 'vid_win.focus();', 250 );
}

