var isMSIE = /*@cc_on!@*/false;
var regexp_email = /^[^@]+@[^@]+\.[a-zA-Z]{2,10}$/;
isSafari = false;
try { if( navigator.vendor.match( /^Apple/ ) ) isSafari = true; } catch(e) {};
var IEVersion = 0 /*@cc_on+ScriptEngineMajorVersion()@*/;
var jscript/*@cc_on=@_jscript_version@*/;

var popup = {

	show: function() {
		
		if( isMSIE ) $('popup-stopclicks').setStyle('background: #fff; opacity: .01').show();
		$('popup-wrapper').show();
		$('popup-bg').setStyle('opacity: 0');
		$('popup-close').setStyle('opacity: 1');
		$('popup-bg').morph('opacity: .95', { duration: .5 } );
		
	},
	
	hide: function() {
		
		$('popup-bg').morph('opacity: 0', { duration: .5 } );
		$('popup-close').morph('opacity: 0', { duration: .3 } );
		setTimeout( function() {
			$('popup-wrapper').hide();
			if( isMSIE ) $('popup-stopclicks').hide();
		}, 600 );
		
	}

}

var forms = {
	
	//clears the value of a input field initially
	clear_initial_value: function( elm ) {
		
		if( elm.cleared === true ) return;
		
		elm.value = '';
		elm.cleared = true;
		
	}

}

//show footer after everything has loaded
Event.observe( window, 'load', function() {

	if( !$('footer') ) return;

	if( isMSIE ) $('footer').setStyle('visibility: visible');
	else $('footer').setStyle('visibility: visible; opacity: 0').appear( { duration: .3 } );

} );

// fix bottom background tiling
Event.observe( window, 'load', fix_footer_bg );
Event.observe( window, 'resize', fix_footer_bg );
function fix_footer_bg() {

	var vp = document.viewport.getDimensions();
	var page_height = 791;

	if( isMSIE || !$('footer') || vp.width >= 910 || vp.height < page_height ) return;

	//how much space is left at the bottom of the page?
	$('footer').setStyle('height: ' + ( 150 + vp.height - page_height ) + 'px');	

}

