	if ( top != self )
	{
		top.location = self.document.location;
	}


	function validate_searchstr_entry()
	{
		var searchString = document.webdirectory.searchstr.value;
		var searchString = TrimString(document.webdirectory.searchstr.value);		

		if ( document.webdirectory.searchstr.value == "" )
		{
			alert( "Please Enter String to Search !");
			document.webdirectory.searchstr.focus();
			return false;
		}
		if ( searchString.length == 0 )
		{
			alert( "Please Enter String to Search !");
			document.webdirectory.searchstr.focus();
			return false;
		}
	}
	
	function validate_data()
	{
		if ( document.webdirectory.searchtype.value == "" )
		{
			alert( "Please Select Search Directory !");
			document.webdirectory.searchtype.focus();
			return false;
		}
	}


	function openWin(url,wname )
	{
		winWidth = screen.width;
		availWidth = screen.availWidth;
		availHeight = screen.availHeight;

		winHeight = availHeight - ( availHeight * 0.088 );

		var win = window.open(url,wname,'directories=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no,copyhistory=no,status=yes,width=' + winWidth + ',height='+ winHeight + ',left=0,top=0');		

		win.focus();	
	} 


	function TrimString(sInString)
	{
		sInString = sInString.replace( /^\s+/g, "" );		// strip leading
		sInString = sInString.replace( /\s+$/g, "" );		// strip trailing
		return sInString;
	}

	function validate_website_data()
	{
		var strWebsiteTitleVal = TrimString(document.website.website_title.value);
		var strWebsiteURLVal = TrimString(document.website.website_url.value);

		var strWebsiteKeywordsVal = TrimString(document.website.website_keywords.value);
		var strWebsiteDescriptionVal = TrimString(document.website.website_description.value);

		/* Validating Website Title */
		if ( document.website.website_title.value == "" )
		{
			alert( "Please Enter Website Title !");
			document.website.website_title.focus();
			return false;
		}
		if ( strWebsiteTitleVal.length == 0 )
		{
			alert( "Please Enter Website Title !");
			document.website.website_title.focus();
			return false;
		}
		if ( strWebsiteTitleVal.length < 10 )
		{
			alert("Your Website Title can not be less than 10 Chars!");
			document.website.website_title.focus();
			return false;
		}
		if ( ( strWebsiteTitleVal.length > 80 ) )
		{
			alert("Your Website Title can not be more than 80 Chars!");
			document.website.website_title.focus();
			return false;
		}

		/* Validating Website Url */
		if ( document.website.website_url.value == "" )
		{
			alert( "Please Enter Website URL !");
			document.website.website_url.focus();
			return false;
		}
		if ( strWebsiteURLVal.length == 0 )
		{
			alert( "Please Enter Website Url !");
			document.website.website_url.focus();
			return false;
		}
		if ( ( strWebsiteURLVal.length > 150 ) )
		{
			alert("Your Website Title can not be more than 150 Chars!");
			document.website.website_url.focus();
			return false;
		}

		/* Validating Website Keywords */
		if ( document.website.website_keywords.value == "" )
		{
			alert( "Please Enter Website Keywords !");
			document.website.website_keywords.focus();
			return false;
		}
		if ( strWebsiteKeywordsVal.length == 0 )
		{
			alert( "Please Enter Website Url !");
			document.website.website_keywords.focus();
			return false;
		}

		/* Validating Website Description */
		if ( document.website.website_description.value == "" )
		{
			alert( "Please Enter Website Description !");
			document.website.website_description.focus();
			return false;
		}
	}


	function countChars()
	{
		var messageStringKeywords = TrimString(document.website.website_keywords.value);
		var messageLengthKeywords = messageStringKeywords.length;

		document.website.siteKeywordsChars.value = messageLengthKeywords;
		setTimeout("countChars()",500);
	}

	function countChars2()
	{
		var messageStringDescription = TrimString(document.website.website_description.value);
		var messageLengthDescription = messageStringDescription.length;

		document.website.siteDescriptionChars.value = messageLengthDescription;
		setTimeout("countChars2()",500);
	}


	function displayTotalChars()
	{
		var messageString2 = document.website.siteKeywordsChars.value;
		var messageLengthKeywords2 = messageString2.length;

		alert( "Your entered Total No. Of Chars " + messageString2 + " for Website Keywords.");

		return false;
	}

	function TrimString(sInString)
	{
		sInString = sInString.replace( /^\s+/g, "" );		// strip leading
		sInString = sInString.replace( /\s+$/g, "" );		// strip trailing
		return sInString;
	}