/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

function submitFrm(theForm)
{
	var v = new RegExp();
	v.compile(/^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/ );

	function trim( str )
	{
		str = str.replace(/^\s+/, "");
		for( var i = str.length-1; i > 0;--i )
		{
			if( /\S/.test( str[i] ) ) {
				str = str.substring( 0, i+1 );
				break;
			}
		}
		return str;
	}

	String.prototype.trimAll = function()
	{
		return this.replace(/\s+/g,"");
	}

	if(trim(theForm.url.value) == "")
	{
		alert ("Oops! You forgot to enter the URL..");
		return false;
	}
	if(!v.test(theForm.url.value))
	{
		alert("We're afraid the URL format entered is invalid! Please re-enter the URL as http://www.domain.com; OR www.domain.com. ");
		return false;
	}

	if(theForm.pageCount.value == 25)
	{
		if(confirm("Please click OK to continue."))
		{
			showPopup();
			return true;
		}
		else
			return false;
	}
	if(theForm.pageCount.value == 50)
	{
		if(confirm("You have requested to process a request for upto 50 pages. Please click OK to continue."))
		{
			showPopup();
			return true;
		}
		else
			return false;
	}
	if(theForm.pageCount.value == 200)
	{
		if(confirm(" Processing the request for upto 200 pages will send the result report to you in an email. Please click OK to continue."))
		{
			//showPopup();
			return true;
		}
		else
			return false;
	}
	if(theForm.pageCount.value == 500)
	{
		if(confirm("Processing the request for upto 500 pages will send the result report to you in an email. Please click OK to continue."))
		{
			//showPopup();
			return true;
		}
		else
			return false;
	}
	if(theForm.pageCount.value == 1000)
	{
		if(confirm("Processing the request for upto 1000 pages will send the result report to you in an email. Please click OK to continue."))
		{
			//showPopup();
			return true;
		}
		else
			return false;
	}
	//showPopup();
	return true;

}


