/*
- isDigit : test it a character is a digit or not.
- trimLeft : cut leading blank spaces of a string.
- trimRight: cut trailing blank spaces of a string.
- trim: cut all leading and trailing blank spaces of a string
- isPosInt: test if a string has the format of a positive integer number or not.
- isPosReal: test if a string has the format of a positive real number or not. The decimal 
			 separator must be ".".
- isValidDate: test if a string has the format of a valid date or not. Format :mm/dd/yyyy
- isEmail: test if a string is a valid e-mail address or not
- isZip: test if a string has the format of a US zip code or not.
- getFileType: return the file extenstion from the full file name.
*/
/*
 isValidDate
 check if a string is a valid date. The format of date can be specified 
 1- is mm/dd/yyyy
 2- is dd/mm/yyyy
 3 -is mm/dd/yy
 4 -is dd/mm/yy 	
*/
function isValidDate(strDate,intFormatDate)
{
 var m;
 var d;
 var y;
 var i1;
 var i2;
 
 if((intFormatDate!=1)&&(intFormatDate!=2)&&(intFormatDate!=3)&&(intFormatDate!=4)) return false;

 strDate=trim(strDate);
 if(strDate=="") return false;
 i1 = strDate.indexOf("/")
 if(i1<0) return false;
 
 if((intFormatDate==1)||(intFormatDate==3))
 	m = strDate.substring(0,i1);
 else
	d = strDate.substring(0,i1);

  
 i2= strDate.indexOf("/",i1+1)
 if(i2<0) return false;

 if((intFormatDate==1) || (intFormatDate==3))
	d = strDate.substring(i1+1,i2);
 else
	m = strDate.substring(i1+1,i2);
 
 y = strDate.substring(i2+1)

 if((m=="")||(d=="")||(y=="")) return false;
 if((m==0)||(d==0)) return false;
 if(!isPosInt(m))
 	 return false;
 else
 	{	
	 m = parseInt(m);
	 if(m>12) return false;
 	}

 if(!isPosInt(y))
 	 return false;
 else
	{
	 y = parseInt(y)
	 if(y>9999) return false;
	 if((y>=100)&&(y<1900)) return false;
	}

 if(!isPosInt(d))
 	 return false;
 else
	{
	 d = parseInt(d)
	 if((m==1)||(m==3)||(m==5)||(m==7)||(m==8)||(m==10)||(m==12))
		 if(d>31) return false;
 	 if((m==4)||(m==6)||(m==9)||(m==11))
		if(d>30) return false;

	 if(m==2)
		{
		 if(d>29) return false;
		 if((y%4)!=0) // not a leap year
		 	if(d>28) return false;
		}
	}

return true
}

/*
 isEmail
 check if an email address is valid (format only) 
*/
function isEmail(strEmail)
{
 var intlen;
 var ctmp;
 strEmail = trim(strEmail);
 if(strEmail=='') return false;
 intlen=strEmail.length;
 if(intlen<5) return false;
 if(strEmail.indexOf('@')==-1 || strEmail.indexOf('@')== 0)  return false;
 if(strEmail.indexOf('.')==-1) return false;
 if(intlen - strEmail.lastIndexOf('.') -1 < 0) return false; 
 if((strEmail.indexOf("_")!=-1) && (strEmail.lastIndexOf("_") > strEmail.lastIndexOf("@"))) return false;
 if(strEmail.lastIndexOf(".") <= strEmail.lastIndexOf("@")+1)  return false;
 if(strEmail.indexOf("@")!=strEmail.lastIndexOf("@")) return false;
 if(intlen -1 == strEmail.lastIndexOf('.')) return false;
 if(strEmail.charAt(strEmail.indexOf('@')+1)=='.') return false;
 if(strEmail.indexOf(" ")!=-1) return false;
 if(strEmail.indexOf("..")!=-1) return false;
 if(strEmail.indexOf("\"") != -1) return false;
 if(strEmail.indexOf("\'") != -1) return false;
 ctmp = strEmail.length - strEmail.lastIndexOf('.');
 if(ctmp  != 4 && ctmp != 3) return false;

 strEmail=strEmail.toLowerCase();
 for(intcnt=0;intcnt<intlen;intcnt++)
	{
	 ctmp = strEmail.charAt(intcnt)
	 if((!isDigit(ctmp))&& ((ctmp>'z')||(ctmp<'a')) && (ctmp!='-') && (ctmp!='.') && (ctmp!='@') && (ctmp!='_')) return false;
	}

return true	;
}
/*
*/
function isUrl(url)
{
		if (url.length < 11) {
			alert ("Url seems incorrect");
			return false;
		}
		else
		{
			var ss;
			var len;
			var dot;
			var urlLower;
			
			urlLower = url.toLowerCase();
			ss = urlLower.substr(0,7);
			if (ss == "http://")
			{
				urlFlag = urlLower.indexOf("http://", 7);
				if (urlFlag > 0) {
					alert ("http:// is entered more than once");
					return false;
				}
			}//end if
			else
			{
				urlFlag = urlLower.indexOf("http://", 1);



				if (urlFlag != -1) {
					alert ("http:// should be at begining of url");
					return false;
				}
			} //else
			dot = urlLower.lastIndexOf(".");
			if (dot == -1) {
				alert ("Dot missing");
				return false;
			}

			ss = urlLower.substr(dot);
			len = ss.length;
			if (len < 3) {
				alert ("Url seems incorrect");
				return false;
			}
 		    if(urlLower.indexOf(" ") != -1) {
				alert ("Url contains whitespace");
				return false;
			}
			if(urlLower.indexOf("..") != -1) {
				alert ("Url conatins consecutive dots");
				return false;
			}
			if(urlLower.indexOf("\"") != -1) {
				alert ("Url conatins \" symbol");
				return false;
			}
			if(urlLower.indexOf("\'") != -1) {
				alert ("Url conatins \' symbol");
				return false;
			}
		}
		
		return true;
}
/* 
 getFileType
 receive a full path file name, return only the file extension
 ex: input = C:\Windows\myfile.txt
  	 output = txt
*/
function getFileType(str)
{
 var filename;
 var fileext;
 var dotpos;
 fileext ='';
 filename = getFileName(str);
 dotpos = filename.lastIndexOf(".");
 
 if(dotpos!=-1)
	{
		fileext = filename.substring(dotpos+1,filename.length);
		fileext = fileext.toLowerCase();
	}
 else
	{
		fileext = '';
	}
 return(fileext);
}
/**/
function getFileName(str)
{
	var temp,extpost,fname;
	temp = str;
	extpost = temp.lastIndexOf("\\");
	if(extpost != -1)
	{
		fname = temp.substring(extpost + 1,temp.length);
		fname = fname.toLowerCase();
	}
	else
	{
		fname = '';
	}
	return(fname);
}
/*
isDigit
Check if a character is a digit or not
*/
function isDigit(c)
{
if((c=='0')||(c=='1')||(c=='2')||(c=='3')||(c=='4')||(c=='5')||(c=='6')||(c=='7')||(c=='8')||(c=='9'))
	return true;
else
	return false;
}

/*
 isPosInt
 check if a string is a valid positive integer
*/
function isPosInt(s)
{
 var n;
 n = s.length
 if(n==0) return false;
 for(i=0;i<n;i++)
	if(!isDigit(s.charAt(i))) return false;
 return true;
}

/*
 isPosReal
 check if  a string is a valid positive real number or not (. as decimal number)
*/
function isPosReal(s)
{
 var dot;
 s = trim(s);
 dot =0;
 for(i=0;i<s.length;i++)
	if(!isDigit(s.charAt(i))) 
		{
			if(s.charAt(i)=='.') 
				{
					dot++;
					if(i==s.length-1) return false;
					if(dot>1) return false;
				}
			else return false;	
		}
 return true;
}

/*
 trimLeft
 Remove all spaces at the beginning of a string
*/
function trimLeft(s)
{
 var i;
 i=0;
 var n;
 n = s.length;
 while((i<n)&&(s.charAt(i)==' ')) i++;
	s = s.substring(i);
 return(s);
} 

/*
 trimRight
 Remove all spaces at the end of a string
*/
function trimRight(s)
{
 var n;
 n = s.length;
 var i;
 i = s.length-1;
 while((i>=0)&&(s.charAt(i)==' ')) i--;
	s = s.substring(0,i+1);
 return(s);
}

/* 
 trim
 Remove all leading and trailing spaces in a string
*/
function trim(s)
{
 s = trimLeft(s);
 s = trimRight(s);
 return(s);
}  


function checkRadio(obj){
	if (obj){
		if (obj.length) {		
			 for (i= 0 ;i< obj.length; i++){
				if (obj[i].checked)  return true;		
			 }		 
		}
		else{
			if (obj.checked)  return true;		
		}
		return false;		
	}
	else {
		return true;
	}
}

/*function to check addresses */
function checkAddress(x) {
	if (x.address1.value == "") {
		alert("Please enter your address address");
		x.address1.focus();
		return false;
	}
	if (x.city.value == "") {
		alert("Please enter city");
		x.city.focus();
		return false;
	}
	if (x.cmbState.value == "") {
		alert("Please select a state");
		x.cmbState.focus();
		return false;
	}
	if (x.zip.value == "") {
		alert("Please enter zip code");
		x.zip.focus();
		return false;
	}
	if (!isValidZipcode(x.zip.value)) {
		
	}
	return true;
}

/*
 isValidZipcode
 receive  a string, return true if it has a valid format of US 5 digits zip code.
*/
// Check that a US zip code is valid
function isValidZipcode(zipcode) {
        zipcode = removeSpaces(zipcode);
        if (!(zipcode.length == 5) || !isNumeric(zipcode)) return false;
        return true;
}
//added allowance for slashes - Gabe - 8/31/04
function isAddress(string, ignoreWhiteSpace) {
        if (string.search) {
                if ((ignoreWhiteSpace && string.search(/[^\.\/\-\,\'\(\)\#\w\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\.\/\-\,\'\(\)\#\W/) != -1)) return false;
        }
        return true;
}
// ***** Check that a string contains only numbers AND $, periods, commas
function isPrice(string, ignoreWhiteSpace) {
        if (string.search) {
                if ((ignoreWhiteSpace && string.search(/[^\.\-\,\$\d\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\.\-\,\$\D/) != -1)) return false;
        }
        return true;
}
// ***** Check that a string contains a strong password that is alphanumeric and not based on username, no spaces, etc.
function isValidPassword(string,UserName,ignoreWhiteSpace) {
        
		if (string.search) {
                if ((ignoreWhiteSpace && string.search(/[^\w\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\W/) != -1)) {
                       alert('password contains spaces and/or non-alphanumeric characters')
                        return false;
                }
        }
        stringLower = string.toLowerCase();
        regex = "/"+UserName.toLowerCase()+"/";
        regexReverse = "/"+formatReverse(UserName.toLowerCase())+"/";
        //if((stringLower.search(regex) != -1) || (stringLower.search(regexReverse) != -1)){
        if((stringLower.search(UserName.toLowerCase()) != -1) || (stringLower.search(formatReverse(UserName.toLowerCase())) != -1)){
                if(string == UserName) {alert('password contains username')}
                return false; // can't contain username (forwards or backwards)
        }
        if( (stringLower.search(/guest/) != -1) || (stringLower.search(/password/) != -1) || (stringLower.search(/user/) != -1) || (stringLower.search(/test/) != -1)  ) {
                alert('password contains common words');
                return false; // can't contain common passwords
        }
        return true;
}
// ***** also, if there's a decimal point, commas, and/or a $ - make sure they're in the right places.
function isPriceFormatted(string) {

        str = strip(" ",string);
        if(    (str.indexOf("$") > 0) || ( (str.indexOf(".") > 0) && (str.indexOf(".") != str.lastIndexOf(".")) )) {
                return false;
        }

        str2 = str;
        commaPos = str2.indexOf(",");
        while (commaPos != -1)  {
                str2 = str2.substr(commaPos+1,str2.length - (commaPos+1))
                commaPos = str2.indexOf(",");
                if ((commaPos != -1) && (commaPos != 3)){
                        return false;
                }
        }

        if (str.indexOf(".") != -1) {  // there's a decimal

                decimalPosFromEnd = str.length - str.indexOf(".");

                // right number of decimal places?
                if (decimalPosFromEnd != 3) {
                        // return false;
                        // MODIFIED 05/29/02 ... allow 2 or more decimal places ...
                }

                // last comma in right place?
                if ( (str.indexOf(",") != -1) && (str.length - str.lastIndexOf(",") != decimalPosFromEnd + 4) ){
                        return false;
                }

        } else {   // no decimal

                // last comma in right place?
                if ( (str.indexOf(",") != -1) && (str.length - str.lastIndexOf(",") != 4) ){
                        return false;
                }
        }

        return true;

}


// Check that a string contains only letters
function isAlphabetic(string, ignoreWhiteSpace) {
	 if(string.indexOf("\'") != -1) return false;
	 if(string.indexOf("\"") != -1) return false;

        if (string.search) {
                if ((ignoreWhiteSpace && string.search(/[^a-zA-Z\s]/) != -1) || (!ignoreWhiteSpace && string.search(/[^a-zA-Z]/) != -1)) return false;
        }
        return true;
}

// *****  Check that a string contains only letters AND special name characters
function isName(string, ignoreWhiteSpace) {

        // if(debug3) {alert('in isName : '+string)}
	 if(string.indexOf("\'") != -1) return false;
	 if(string.indexOf("\"") != -1) return false;
	 if(string.indexOf("@") != -1) return false;
	 if(string.indexOf("#") != -1) return false;
	 if(string.indexOf("$") != -1) return false;
	 if(string.indexOf("%") != -1) return false;
	 if(string.indexOf("&") != -1) return false;
	 if(string.indexOf("*") != -1) return false;
	 if(string.indexOf("\"") != -1) return false;
	 if(string.indexOf("\'") != -1) return false;
	 
	 

        if (string.search) {
                if ((ignoreWhiteSpace && string.search(/[^()a-zA-Z\.\-\,\'\s]/) != -1) || (!ignoreWhiteSpace && string.search(/[^()a-zA-Z\.\-\,\']/) != -1)) return false;
        }
        return true;
}


// Check that a string contains only numbers
function isNumeric(string, ignoreWhiteSpace) {
        if (string.search) {
                if ((ignoreWhiteSpace && string.search(/[^\d\s]/) != -1) || (!ignoreWhiteSpace && string.search(/\D/) != -1)) return false;
        }
        return true;
}

// Check that a string contains only numbers and floats
function isfNumeric(string, ignoreWhiteSpace) {
        if (string.search) {
                if ((ignoreWhiteSpace && string.search(/[^\d\s\.]/) != -1) || (!ignoreWhiteSpace && string.search(/\D/) != -1)) return false;
        }
        return true;
}

// Remove characters that might cause security problems from a string
function removeBadCharacters(string) {
        if (string.replace) {
                string.replace(/[<>\"\'%;\)\(&\+]/, '');
        }
        return string;
}
function isValidUSPhone(str){
        str = strip("*() -./_\n\r\t\\",str);
        if(str.length == 10) // || str.length == 7  ***commented out - must always include area code
                return true;
        else
                return false;
}
function removeSpaces(string) {
        var newString = '';
        for (var i = 0; i < string.length; i++) {
                if (string.charAt(i) != ' ') newString += string.charAt(i);
        }
        return newString;
}

/*takes form elements as array and disables them*/
function disable(f, element_array, keep_populated, custom_class)
{
	if(!custom_class)custom_class='disabled'
	for(i=0; i<element_array.length; i++)
	{
		if(f.elements[element_array[i]]){
			f.elements[element_array[i]].disabled=true;
			f.elements[element_array[i]].className=custom_class;
			if(f.elements[element_array[i]].type=='text')
			{
				if(!keep_populated)
				{
					f.elements[element_array[i]].value='';
				}
			}
			//alert(f.elements[element_array[i]].type);

		}
	}

}

/*takes form elements as array and enables them*/
function enable(f, element_array, keep_data, custom_class)
{
	for(i=0; i<element_array.length; i++)
	{
		if(f.elements[element_array[i]]){
			f.elements[element_array[i]].disabled=false;
			f.elements[element_array[i]].className=custom_class;
			if(f.elements[element_array[i]].type=='text')
			{
				if(!keep_data)f.elements[element_array[i]].value=f.elements[element_array[i]].defaultValue;
			}
		}

	}

}

/*function to return weekday names for input numbers*/
function weekdayName (n) {
	if (n == 1)
		return 'Monday';
	else if (n == 2)
		return 'Tuesday';
	else if (n == 3)
		return 'Wednesday';
	else if (n == 4)
		return 'Thursday';
	else if (n == 5)
		return 'Friday';
	else if (n == 6)
		return 'Saturday';
	else if (n == 7)
		return 'Sunday';
}

/*function to return weekday number for input names*/
function weekdayNum (str) {
	if (str == 'Monday')
		return 1;
	else if (str == 'Tuesday')
		return 2;
	else if (str == 'Wednesday')
		return 3;
	else if (str == 'Thursday')
		return 4;
	else if (str == 'Friday')
		return 5;
	else if (str == 'Saturday')
		return 6;
	else if (str == 'Sunday')
		return 7;
}

/*for selecting service categories*/

function SelectCopySelected(poFrom, poTo)
{

	var lnValidCount = 0;
	var lnErrorCount = 0;
	var lnProcessedCount = 0;
	var lsErrorText = '';
	for (var lnCount = 0; lnCount < poFrom.options.length; lnCount++)
		{
			if (poFrom.options[lnCount].selected && poFrom.options[lnCount].value != '')
				{
					lnProcessedCount += 1;
					if (!SelectAddOption(poTo, poFrom.options[lnCount].value, poFrom.options[lnCount].text))
						{
							lnErrorCount += 1;
							lsErrorText += '\'' + poFrom.options[lnCount].text + '\'' + ', ';
						}
					else
						lnValidCount += 1;
				}
		}
	switch (lnProcessedCount)
		{
			case 0:
				break;
			case 1:
				if (lnErrorCount == 1)
					alert('This item has already been selected.');
				break;
			default:
				if (lnValidCount > 0 && lnErrorCount > 0)
					{
						lsErrorText = left(lsErrorText, lsErrorText.length - 2);
						alert(lsErrorText + ' ' + (lnErrorCount > 1 ? 'are' : 'is') + ' already selected and ' + (lnErrorCount > 1 ? 'were' : 'was') + ' not added.');
					}
				else if (lnValidCount == 0 && lnErrorCount > 0)
					alert('These items have already been selected.');

		}
}

function SelectDeleteSelected(poSelect)
{
	for (var lnCount = poSelect.options.length - 1; lnCount >= 0; lnCount--)
		{
			if (poSelect.options[lnCount].selected && poSelect.options[lnCount].value != '')
				{
					SelectDeleteOption(poSelect, lnCount);
				}
		}
}

function SelectAddOption(poSelect, psValue, psText)
{
	//-- make sure this value is not already an option
	for (var lnCount = 0; lnCount < poSelect.options.length; lnCount++)
		{
			if (poSelect.options[lnCount].value == psValue)
				{
					return false;
				}
		}
	var loOption = new Option(psText, psValue);
	poSelect.options[poSelect.options.length] = loOption;
	
	return true;
}

function SelectDeleteOption(poSelect, pnIndex)
{
	poSelect.options[pnIndex] = null;
}

    function createWindow(u,n,w,h,r)
    {
        args = 'width='+w+',height='+h+',resizable=no,scrollbars=yes,status=0';
        remote = window.open(u,n,args);
        if( remote != null ) {
            if (remote.opener == null) {
                remote.opener =  self ;
            }
        }
        if( r == 1 ) { return remote; }
    }

    var attw =null;
    var drww =null;

    function Attach( url )
    {
        if( !attw || attw.closed ) {
           attw = createWindow( url,  'addServ', 500, 300, 1) ;
        }
        attw.focus();
		
    }

function AvailabilityAdd(document_id)
{
	//alert('in');
	var loForm = document.techform;
	
	if (!loForm.weekday.value)
	{
		alert('Please select a weekday');
		return false;
	}
	
	var lsTmp = GetSelectValue(loForm.weekday);
	
	//alert('var lsTmp is: '+lsTmp);

	var laTmp = lsTmp.split(';');

	//alert('var laTmp is: '+laTmp);

	var lsSort;
	var lsWeekday;

	//-- get only the day of week since lsWeekday consists of sort order and day of week
	if (laTmp[0] != '') //(isArray(laTmp))
		{
			lsSort = laTmp[0];
			lsWeekday= laTmp[1];
		}
		else 
		{
		//alert('wrong data passed through');
		return false;	//-- wrong data passed through
		}

	//alert('woa');
	var lsTimeFrom = GetSelectValue(loForm.time_from);
	var lsTimeTo = GetSelectValue(loForm.time_to);

	//-- error check - start
	//-- start time cannot be greater than or equal to end time
	if (lsTimeFrom >= lsTimeTo)
		{
			alert('"From" time cannot be greater than or equal to the "To" time.');
			return false;
		}

	//-- check for time overlaps
	for (var lnCount = 0; lnCount < loForm.elements[document_id].options.length; lnCount++)
		{
			laAvailability = (loForm.elements[document_id].options[lnCount].value).split(';');
			/*
			laAvailability[0] = sort order
			laAvailability[1] = day of week
			laAvailability[2] = From time
			laAvailability[3] = To time
			*/

			if (laAvailability[0] != '')    //(isArray(laAvailability))
				{
					//-- check for overlap only on the same day of week
					if (laAvailability[1] == lsWeekday)
						{
							//-- check if time overlaps
							if (lsTimeTo > laAvailability[2] && lsTimeTo <= laAvailability[3] || lsTimeFrom >= laAvailability[2] && lsTimeFrom < laAvailability[3])
								{
									alert('Check selected times for overlap on ' + lsWeekday + '.');
									return false;
								}
						}
			}
			else
				return false;	//-- wrong data passed through
		}

	//-- error check - end

	var lsValue = lsSort + ';' + lsWeekday  + ';' + lsTimeFrom + ';' + lsTimeTo;
	var lsText = lsWeekday + ' ' + GetSelectText(loForm.time_from) + ' - ' + GetSelectText(loForm.time_to);

	SelectAddOption(loForm.elements[document_id], lsValue, lsText);
}

function AvailabilityDelete(document_id)
{
	var loForm = document.techform;
	for (var lnCount = loForm.elements[document_id].options.length - 1; lnCount >= 0; lnCount--)
		{
			if (loForm.elements[document_id].options[lnCount].selected && loForm.elements[document_id].options[lnCount].value != '')
				{
					SelectDeleteOption(loForm.elements[document_id], lnCount);
				}
		}
}

function GetSelectValue(poSelect)
{
	return poSelect.options[poSelect.selectedIndex].value;
}

function GetSelectText(poSelect)
{
	return poSelect.options[poSelect.selectedIndex].text;
}

function SelectSortOptions(poSelect, pbSortByValue)
{
	var laTmp = new Array();
	if (pbSortByValue)
		for (var lnCount = 0; lnCount < poSelect.options.length; lnCount++)
			laTmp[lnCount] = new Array(poSelect[lnCount].value, poSelect[lnCount].text);
	else
		for (var lnCount = 0; lnCount < poSelect.options.length; lnCount++)
			laTmp[lnCount] = new Array(poSelect[lnCount].text, poSelect[lnCount].value);
		//-- sort numerically
		//laTmp.sort(function(a,b) { return a[0] - b[0]; });
		//-- sort alphabetically
		laTmp.sort(function(a,b) { return a[0].toLowerCase() < b[0].toLowerCase() ? -1 : a[0].toLowerCase() > b[0].toLowerCase() ? 1 : 0; });
	for (var lnCount = poSelect.options.length - 1; lnCount >= 0; lnCount--)
		SelectDeleteOption(poSelect, lnCount);
	if (pbSortByValue)
		for (var  lnCount = 0; lnCount < laTmp.length; lnCount++)
			SelectAddOption(poSelect, laTmp[lnCount][0], laTmp[lnCount][1]);
	else
		for (var  lnCount = 0; lnCount < laTmp.length; lnCount++)
	SelectAddOption(poSelect, laTmp[lnCount][1], laTmp[lnCount][0]);
}

function isArray()
{
	if (typeof arguments[0] == 'object')
		{
			var criterion = arguments[0].constructor.toString().match(/array/i);
			return (criterion != null);
		}
	return false;
}

function selectList (oSelect) {
	//alert("In this function");
	for (i=0; i < oSelect.length; i++) {
		oSelect.options[i].selected = true;
	}
	return true;
}

function isPhoneNo(val)
{
	//checks for a phone number which contains digits from 0 to 9 and - symbol
		len = val.length;
		for(i=0;i<len;i++)
			if(!isDigit(val.charAt(i))) 
				if(val.charAt(i) != "-")
					return false;
		return true;
}
function sqlInject(val)
{
	//if finds ' or " then returns true
	 if(val.indexOf("\"") != -1) return false;
	 if(val.indexOf("\'") != -1) return false;
	 return true;
	
}
