
// JavaScript Document
function myPopup1( url ) {
	window.open( 'popup.php?img='+url, "myWindow2", "status = no, height = 610, width = 1024, resizeable = 0, location = no" )
}

function myPopup2( url ) {
	window.open( url, "myWindow", "status = , height = 600, width = 640, resizeable = 0" )
}
function myPopup3( url ) {
	window.open( 'popup.php?img='+url, "myWindow2", "status = 0, height = 470, width = 400, resizeable = 0" )
}
function myPopup4( url ) {
	window.open( 'popup.php?img='+url, "myWindow2", "status = 0, height = 705, width = 1024, resizeable = 0" )
}




$(window).load(function() {
	 $('#blankout').fadeOut( 1000 );
});

function unLoad(uri)
{ 

	$('#blankout1').fadeIn( 1000, function()
										   	{
												
												window.location = uri;
											});

}

function pause()
{
	Pause = true;
	
}

var arrValidCVExt = new Array( '.doc' , '.rtf' );



function rtrim( str )
{
	while ( str.charAt( ( str.length - 1 ) ) == ' ' )
		str = str.substring( 0 , str.length - 1 );
	return str;
}

function ltrim( str )
{
	while ( str.charAt( 0 ) == ' ' )
		str = str.replace( str.charAt( 0 ) , '' );
	return str;
}

function trim( str )
{
	return rtrim( ltrim( str ) );
}

function getFileExt( fileName )
{
	var dot = fileName.lastIndexOf( '.' );
	if ( dot == -1 ) return '';
	var ext = fileName.substr( dot , fileName.length );
	ext = ext.toLowerCase();
	return ext;
}

function in_array( value , array )
{
	for ( var count = 0; count < array.length; count++ )
	{
		if ( array[ count ] == value )
			return true;
	}
	return false;
}



function validForm( frm )
{
	if ( trim( frm.fname.value ) == '' )
	{
		alert( 'Please provide first name!' );
		frm.fname.select();
		frm.fname.focus();
		return false;
	}
	
	if ( frm.cv_file.value == '' )
	{
		alert( 'Please first browse for CV!' );
		frm.cv_file.select();
		frm.cv_file.focus();
		return false;
	}

	var fileExt = getFileExt( frm.cv_file.value );
	
	if ( !in_array( fileExt , arrValidCVExt ) )
	{
		alert( 'CV is only accepted in following types:\n\n' + frm.validCVExt.value );
		frm.cv_file.focus();
		return false;
	}
	
	return true;
}
