/*********************************************************************************
*	Company Name: Ufnasoft
*	JavaScript Library	
*	Address: 	Block 3, Street 33, F-8/1, Islamabad, Pakistan 
*	Website:	www.ufnasoft.com
**********************************************************************************/


/*********************************************************************************
*	FUNCTION:		win_minipage
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:		id,showIcon 	

**********************************************************************************/
function win_minipage(customerid)
{
	var winName="winWebsite";
	var doc="win_minipage.cfm?customerid="+customerid;
	var winHeight=700;
	var winWidth=700
	
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(doc,winName,opt);
	newWin.focus();
}


/*********************************************************************************
*	FUNCTION:		show_video
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:		hostingurl, videoname

**********************************************************************************/
function show_video(hostingurl, videoname)
{
	var winName="winWebsite";
	var doc="/show_video.cfm?hostingurl="+hostingurl+"&videoname="+videoname;
	var winHeight=350;
	var winWidth=425
	
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=1,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(doc,winName,opt);
	newWin.focus();
}



/*********************************************************************************
*	FUNCTION:		win_web
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:		id,showIcon 	

**********************************************************************************/
function win_web(customerid)
{
	var winName="winWebsite";
	var doc="/win_web.cfm?customerid="+customerid;
	var winHeight=700;
	var winWidth=900
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(doc,winName,opt);
	newWin.focus();
}

/**** win_email */
function win_email(customerid)
{
	var winName="winContent";
	var doc="/win_email.cfm?customerid="+customerid+"&minipage=0";
	var winHeight=400;
	var winWidth=500;
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(doc,winName,opt);
	newWin.focus();

}
/*********************************************************************************
*	FUNCTION:		showMinipage
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:		id,showIcon 	

**********************************************************************************/

function showMinipage(customerid, minipage)
{
	var winName="winContent";
	var doc="/minipage.cfm?customerid="+customerid+"&minipage=0";
	var winHeight=540;
	var winWidth=622;
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(doc,winName,opt);
	newWin.focus();

}

/*********************************************************************************
*	FUNCTION:		showWebsite
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:		id	

**********************************************************************************/

function showWebsite(customerid)
{
	var winName="winWebsite";
	var doc="/miniShowWebsite.cfm?customerid="+customerid;
	var winHeight=700;
	var winWidth=900
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(doc,winName,opt);
	newWin.focus();

}
/*********************************************************************************
*	FUNCTION:		showMail
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:		id, showmail 	

**********************************************************************************/

function showMail(customerid, mail)
{
	var winName="winContent";
	var doc="/minimail.cfm?customerid="+customerid+"&mail=0";
	var winHeight=520;
	var winWidth=622;
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(doc,winName,opt);
	newWin.focus();

}


/*********************************************************************************
*	FUNCTION:		showClick2Call
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:	

**********************************************************************************/

function showClick2Call(customerid, businessname)
{

	var winName="winContent";
	var doc="/miniClick2Call.cfm?customerid="+customerid+"&businessname="+businessname;
	var winHeight=620;
	var winWidth=622;
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(doc,winName,opt);
	newWin.focus();

}

/*********************************************************************************
*	FUNCTION:		help_categories
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:			

**********************************************************************************/

function help_categories()
{
	var winName="winContent";
	var doc="categories.cfm";
	var winHeight=420;
	var winWidth=540
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(doc,winName,opt);
	newWin.focus();

}

/*********************************************************************************
*	FUNCTION:		search_help
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:			

**********************************************************************************/

function search_help()
{
	var winName="winContent";
	var doc="/search_help.cfm";
	var winHeight=420;
	var winWidth=540
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(doc,winName,opt);
	newWin.focus();

}

/*********************************************************************************
*	FUNCTION:		help_City
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:			

**********************************************************************************/

function help_city()
{
	var winName="winContent";
	var doc="/help_city.cfm";
	var winHeight=420;
	var winWidth=540
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(doc,winName,opt);
	newWin.focus();

}


/*********************************************************************************
*	FUNCTION:		Search
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:		Search 	

**********************************************************************************/


function showSearch()
{
	var winNameSearch="winContent";
	var doc="/showSearch.cfm";
	var winHeight=375;
	var winWidth=1000;
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWinSearch = window.open(doc,winNameSearch,opt);
	newWinSearch.focus();

}




/*********************************************************************************
*	FUNCTION:		showSpecialOffer
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:		id, specialoffer 	

**********************************************************************************/

function showSpecialOffer(customerid, specialoffer)
{
	var winName="winContent";
	var doc="/miniSpecialOffer.cfm?customerid="+customerid+"&specialoffer=0";
	var winHeight=540;
	var winWidth=622;
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWin = window.open(doc,winName,opt);
	newWin.focus();

}

/*********************************************************************************
*	FUNCTION:		win_map
*	DESCRIPTION:	Opens a document in a new window.			
*	PARAMETERS:		address
*	CALLS:			NOTHING
*	RETURNS:		NOTHING
**********************************************************************************/

function win_map(address)
{
	var winNameMap="winContent";
	var doc="/win_map.cfm?address="+address;
	var winHeight=800;
	var winWidth=900
	var opt="toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1";
	opt+=",resizable=0,";
	opt+=("width="+winWidth+",height="+winHeight);
	newWinMap = window.open(doc,winNameMap,opt);
	newWinMap.focus(); 
	
	/*
	document.thisMapForm.action.value="http://www.mapquest.com/maps/map.adp";
	document.thisMapForm.method.value="get";
	document.thisMapForm.address.value=address;
	document.thisMapForm.city.value=city;
	document.thisMapForm.state.value=state;
	document.thisMapForm.zipcode.value=zipcode;
	document.thisMapForm.search.value="Search";
	document.thisMapForm.submit(); */
}

/*********************************************************************************
*	FUNCTION	isEmpty checks if the parameter is empty or null
*	PARAMETER	str		AS String
**********************************************************************************/
function isEmpty (str) {
	if ((str==null)||(str.length==0)) return true;
	else return(false);
}

/*********************************************************************************
*	FUNCTION	isStringEmpty checks if the parameter is empty or null and focus the field
*	PARAMETER	str		AS String
**********************************************************************************/

function isStringEmpty (str,focus,errorMessage) {
	if ((str==null)||(str.length==0))
	{
		alert("Please provide "+errorMessage);
		focus.focus();
		return true;
	}
	else return(false);
}

/*********************************************************************************
*	FUNCTION	isNotNumber if the parameter is numeric or null and focus the field
*	PARAMETER	n		AS String
**********************************************************************************/

function isNotNumber (n,focus) {
	if((isNaN(n) == true) || n <= 0) 
	{
		
		return true;
	}
	else return(false);
}

/*********************************************************************************
*	FUNCTION:		checkEmailCharacters
*	PARAMETER:		String (Email Address)
*	RETURNS:		FALSE if the String is a valid Email address
*					TRUE if the passed string is not a valid Email Address
*	EMAIL FORMAT:	AnyName@EmailServer e.g; webmaster@hotmail.com
*					@ sign can appear only once in the email address.
**********************************************************************************/


function checkEmailCharacters(theStr) {
  var validchars = "abcdefghijklmnopqrstuvwxyz0123456789@.-_";
  var isOk=false;
  for (var i=0; i < theStr.length; i++) {
    var letter = theStr.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) < 0) {
		isOk=true;	
		}
  }
  return isOk;
}

/*********************************************************************************
*	FUNCTION:		isNotValidEmail
*	PARAMETER:		String (Email Address, focus)
*	RETURNS:		FALSE if the String is a valid Email address
*					TRUE if the passed string is not a valid Email Address
*	EMAIL FORMAT:	AnyName@EmailServer e.g; webmaster@hotmail.com
*					@ sign can appear only once in the email address.
**********************************************************************************/
function isNotValidEmail (theStr, focus) {
	var atIndex = theStr.indexOf('@');
	var dotIndex = theStr.indexOf('.', atIndex);
	theSub = theStr.substring(0, dotIndex+1)
	
	if ((atIndex < 1)||(atIndex != theStr.lastIndexOf('@'))||(dotIndex < atIndex + 2)||(theStr.length <= theSub.length)) 
	{	
		alert("Invalid Email Address.");
		focus.focus();
		return true;
	}
	else { return false; }
	
}

function checkPhoneCharacters(theStr) {
  var validchars = " +-0123456789";
  var isOk=false;
  for (var i=0; i < theStr.length; i++) {
    var letter = theStr.charAt(i).toLowerCase();
    if (validchars.indexOf(letter) < 0) {
		isOk=true;	
		}
  }
  return isOk;
}
/*********************************************************************************
*	EO_JSLib.js
**********************************************************************************/