/***
*	A huge thanks to Dean Parkinson for the help with this widget
*/
/************************************************************************************************************
@fileoverview
Slide out menu
Copyright (C) 2007  Dean Parkinson

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

Alf Magne Kalleland, 2007
Owner of DHTMLgoodies.com


************************************************************************************************************/	
var MENUDIV_ID = "dhtmlgoodies_menu";
var SUBMENU_CLASS = 'dhtmlgoodies_subMenu';
var menuItems;
var slideSpeed_out = 10;	// Steps to move sub menu at a time ( higher = faster)
var slideSpeed_in = 10;
var delayMenuClose = 150;	// Microseconds from mouseout to close of menu
var slideTimeout_out = 0;	// Microseconds between slide steps ( lower = faster)
var slideTimeout_in = 0;	// Microseconds between slide steps ( lower = faster)
var xOffsetSubMenu = 0; 	// Offset x-position of sub menu items - use negative value if you want the sub menu to overlap main menu

/* Don't change anything below here */

var indeces = new Array();
indeces[0] = 0;
var isMSIE = navigator.userAgent.indexOf('MSIE')>=0?true:false;
var browserVersion = parseInt(navigator.userAgent.replace(/.*?MSIE ([0-9]+?)[^0-9].*/g,'$1'));
if(!browserVersion)browserVersion=1;

function mouseOn(obj) {
	var mi = findNode(getSearchIdFromObj(obj));
	if (mi) mi.mouseOn();
}

function mouseOff(obj) {
	var mi = findNode(getSearchIdFromObj(obj));
	if (mi) mi.mouseOff();
}

function getSearchIdFromObj(obj) {
	// pull the postfix off the A link or LI tag id and return the menu item ID
	var objId = obj.id;
	var idx = objId.indexOf('_');
	if (idx>=0) {
		return "MenuItem" + objId.substring(idx);
	}
	return null;
}

function slideChildMenu(aId) {
	var mi = findNode(aId);
	if (mi) mi.slideChildMenu();
}

// ==============================================================================


var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)

/////No further editting needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden){
if (ie5||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
return clickreturnvalue()
}

function clickreturnvalue(){
if ((ie5||ns6) && !enableanchorlink) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}



function findNode(searchId) {
	var result;
	for (var no=0;no<menuItems.length;no++) {
		result = menuItems[no].findNode(searchId);
		if (result) return result;
	}
	return null;
}

function getNextIndex(lvl) {
	var result = 0;
	if (indeces.length<=lvl) {
		indeces[lvl] = 1;
	} else {
		result = indeces[lvl];
		indeces[lvl]++;
	}
	return result;
}

function MenuItem(divref, ulref, liref, lvlnum, parentref) {
	this.parent = parentref;
	this.div = divref;
	this.ul = ulref;
	this.width = this.ul.offsetWidth;
	// this.left = div.style.left.replace(/[^0-9]/g,'');
	this.li = liref;
	this.alink = this.li.getElementsByTagName('A')[0];
	this.lvl = lvlnum;
	this.idx = getNextIndex(this.lvl);
	this.children;
	this.subUL = this.li.getElementsByTagName('UL')[0];
	this.children;
	this.isMouseOnMe = false;
	// note: if !isOpen && !isClosed then I am animating a slide
	this.isChildMenuOpen = false;
	this.isChildMenuClosed = true;

	// Constructor
	// if a node does not have an A tag but it's children do then we need
	// null out this node's alink field...
	if (this.alink) {
		if (this.alink.parentNode!=this.li) this.alink = null;
	}
	if (this.subUL) {
		this.children = new Array();
		var subLI = this.subUL.getElementsByTagName('LI')[0];
		while(subLI) {
			if(subLI.tagName && subLI.tagName.toLowerCase()=='li') {
				this.children[this.children.length] = new MenuItem(null, this.subUL, subLI, this.lvl + 1, this);
			}
			subLI = subLI.nextSibling;
		}
	}

	this.getPostfix = function() {
		return '_' + this.idx + '_' + this.lvl;
	}
	
	this.getId = function() {
		return "MenuItem" + this.getPostfix();
	}

	this.hasChildren = function() {
		return (this.children!=null);
	}

	this.getTopPos = function() {
		var origDisp = this.div.style.display;
		this.div.style.display = "";
		var obj = this.li;
		var result = obj.offsetTop;
		while((obj = obj.offsetParent) != null) result += obj.offsetTop;
		this.div.style.display = origDisp;
		return result;
	}

	this.getLeftPos = function() {
		var origDisp = this.div.style.display;
		this.div.style.display = "";
		var obj = this.li;
		var result = obj.offsetLeft;
		while((obj = obj.offsetParent) != null) result += obj.offsetLeft;
		this.div.style.display = origDisp;
		return result;
	}

	this.renderNode = function() {
		// set node properties
		this.li.id = "menuItemLI" + this.getPostfix();
		this.ul.style.position = "relative";
		if (this.alink) {
			this.alink.id = "menuItemA" + this.getPostfix();
			this.alink.onmouseover = function() {mouseOn(this);};
			this.alink.onmouseout = function() {mouseOff(this);};
		} else {
			this.li.onmouseover = function() {mouseOn(this);};
			this.li.onmouseout = function() {mouseOff(this);};
		}

		// set sub-menu nodes
		if (this.hasChildren()) {
			var mi = this.children[0];
			var subdiv = document.createElement('DIV');
			subdiv.className=SUBMENU_CLASS;
			document.body.appendChild(subdiv);
			subdiv.id = "menuItemDIV" + mi.getPostfix();
			this.subUL.id = "menuItemUL" + mi.getPostfix();
			subdiv.appendChild(this.subUL);
			subdiv.style.left = this.getLeftPos() + this.width + xOffsetSubMenu + 'px';
			subdiv.style.top = this.getTopPos() + 'px';
			subdiv.style.visibility = "hidden";
			subdiv.style.display = "none";
			subdiv.style.zindex = "1000";
			for (var no=0;no<this.children.length;no++) {
				var mi = this.children[no];
				mi.div = subdiv;
				mi.renderNode();
			}
		}
		return this.li;
	}

	this.findNode = function(searchId) {
		var result;
		if (this.getId() == searchId) {
			result = this;
		} else {
			if (this.hasChildren()) {
				for (var no=0;no<this.children.length;no++) {
					var mi = this.children[no];
					result = mi.findNode(searchId);
					if (result!=null) break;
				}
			}
		}
		return result;
	}

	this.mouseOn = function() {
		this.isMouseOnMe = true;
		if (this.hasChildren() && this.isChildMenuClosed) {
			this.initiateChildMenuOpen();
		}
	}

	this.mouseOff = function() {
		this.isMouseOnMe = false;
		if (this.hasChildren() && !this.isChildMenuClosed) {
			this.initiateChildMenuClose();
		} else if (this.parent) {
			this.parent.mouseOff();
		}
	}

	this.isMouseOnChild = function() {
		if (this.isMouseOnMe) return true;
		if (this.hasChildren()) {
			for (var no=0;no<this.children.length;no++) {
				if (this.children[no].isMouseOnChild()) return true;
			}
		}
		return false;
	}

	this.initiateChildMenuOpen = function() {
		this.isChildMenuClosed = false;
		var childDiv = this.children[0].div;
		childDiv.style.width = "0px";
		childDiv.style.visibility = "visible";
		childDiv.style.display = "";
		this.slideChildMenu();
	}

	this.initiateChildMenuClose = function() {
		this.isChildMenuOpen = false;
		// we have to wait to close the menu
		// allow the mouse to navigate over the child menu
		setTimeout("slideChildMenu('" + this.getId() + "')", delayMenuClose);
	}

	this.slideChildMenu = function() {
		var divref = this.children[0].div;
		var ulref = this.children[0].ul;
		var maxwidth = this.children[0].width;
		var nextWidth;
		if (this.isMouseOnMe  || this.isMouseOnChild()) {
			nextWidth = divref.offsetWidth + slideSpeed_out;
			if (nextWidth >= maxwidth) {
				this.finishOpeningChild(divref, ulref, maxwidth);
			} else {
				ulref.style.left = nextWidth - maxwidth + "px";
				divref.style.width = nextWidth + "px";
				setTimeout("slideChildMenu('" + this.getId() + "')", slideTimeout_out);
			}
		} else {
			nextWidth = divref.offsetWidth - slideSpeed_in;
			if (nextWidth <= 0) {
				this.finishClosingChild(divref, ulref, maxwidth);
			} else {
				ulref.style.left = nextWidth - maxwidth + "px";
				divref.style.width = nextWidth + "px";
				setTimeout("slideChildMenu('" + this.getId() + "')", slideTimeout_out);
			}
		}
	}

	this.finishOpeningChild = function(divref, ulref, maxwidth) {
		this.isChildMenuOpen = true;
		this.isChildMenuClosed = false;
		ulref.style.left = "0px";
		divref.style.width = maxwidth + "px";
	}

	this.finishClosingChild = function(divref, ulref, maxwidth) {
		this.isChildMenuOpen = false;
		this.isChildMenuClosed = true;
		divref.style.visibility = "hidden";
		divref.style.display = "none";
		divref.style.width = maxwidth + "px";
		if (this.parent) this.parent.mouseOff();
	}

}

function collectMenuNodes(menuObj) {
     if (!menuObj) return null;

     var results = new Array();
     var menuUL = menuObj.getElementsByTagName('UL')[0];
     var menuLI = menuUL.getElementsByTagName('LI')[0];
     while(menuLI) {
        if(menuLI.tagName && menuLI.tagName.toLowerCase()=='li') {
              results[results.length] = new MenuItem(menuObj, menuUL, menuLI, 0, null);
        }
        menuLI = menuLI.nextSibling;
     }
     return results;
}

function initMenu() {
	var mainDiv = document.getElementById(MENUDIV_ID);
	menuItems = collectMenuNodes(mainDiv);
	if (menuItems) {
		for (var no=0;no<menuItems.length;no++) {
			var mi = menuItems[no];
			mi.renderNode();
		}
		mainDiv.style.visibility = 'visible';
	}
	// window.onresize = resetPosition;
}

window.onload = initMenu;




function emailCheck(objEmail)
{
	//alert(objEmail);
	if(objEmail.value=="")
	{
		alert("Enter your email pls....");
		//form1.email.select();
		return false;
	}
	else
	{
		var mail=objEmail.value;
		/*
    aindex=mail.indexOf("@");
		nexta=mail.lastIndexOf("@");
		dotindex=mail.lastIndexOf(".");
		if((aindex > 0)&&(aindex==nexta)&&(dotindex>aindex)&&((dotindex-aindex)>1))
		{
			return true;
		}
		else
		{	
			alert("Enter your email in proper format.");
			//form1.email.select();
			return false;
		}	*/
    		return emailCheck1(mail);
	}
}
/*function emailCheck1 (emailStr) {
    //The following pattern is used to check if the entered e-mail address
    //fits the user@domain format.  It also is used to separate the username
    //from the domain.
var emailPat=/^(.+)@(.+)$/
    //The following string represents the pattern for matching all special
    //characters.  We don't want to allow special characters in the address. 
    //These characters include ( ) < > @ , ; : \ " . [ ]
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
    //The following string represents the range of characters allowed in a 
    //username or domainname.  It really states which chars aren't allowed.
var validChars="\[^\\s" + specialChars + "\]"
    //The following pattern applies if the "user" is a quoted string (in
    //which case, there are no rules about which characters are allowed
    //and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
    //is a legal e-mail address.
var quotedUser="(\"[^\"]*\")"
    //The following pattern applies for domains that are IP addresses,
    //rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
    //E-mail address. NOTE: The square brackets are required.
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
    //The following string represents an atom (basically a series of
    //non-special characters.) 
var atom=validChars + '+'
    //The following string represents one word in the typical username.
    //for example, in john.doe@somewhere.com, john and doe are words.
    //Basically, a word is either an atom or quoted string.
var word="(" + atom + "|" + quotedUser + ")"
    //The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
    //The following pattern describes the structure of a normal symbolic
    //domain, as opposed to ipDomainPat, shown above.
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
    //Finally, let's start trying to figure out if the supplied address is valid. //
    //Begin with the coarse pattern to simply break up user@domain into
    //different pieces that are easy to analyze.
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
    //Too many/few @'s or something; basically, this address doesn't
    //even fit the general mould of a valid e-mail address.
	alert("Please enter Correct Email address")
	return false
}
}*/
function emailCheck1 (emailStr) {
    //The following pattern is used to check if the entered e-mail address
    //fits the user@domain format.  It also is used to separate the username
    //from the domain.
var emailPat=/^(.+)@(.+)$/
    //The following string represents the pattern for matching all special
    //characters.  We don't want to allow special characters in the address. 
    //These characters include ( ) < > @ , ; : \ " . [ ]
	// !@#$%^&*()+=\/[]{}~`'""
var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]$*{}/^+#%&€=§!`~'"
//var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
    //The following string represents the range of characters allowed in a 
    //username or domainname.  It really states which chars aren't allowed.
var validChars="\[^\\s" + specialChars + "\]"
    //The following pattern applies if the "user" is a quoted string (in
    //which case, there are no rules about which characters are allowed
    //and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
    //is a legal e-mail address.
var quotedUser="(\"[^\"]*\")"
    //The following pattern applies for domains that are IP addresses,
    //rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
    //E-mail address. NOTE: The square brackets are required.
var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
    //The following string represents an atom (basically a series of
    //non-special characters.) 
var atom=validChars + '+'
    //The following string represents one word in the typical username.
    //for example, in john.doe@somewhere.com, john and doe are words.
    //Basically, a word is either an atom or quoted string.
var word="(" + atom + "|" + quotedUser + ")"
    //The following pattern describes the structure of the user
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
    //The following pattern describes the structure of a normal symbolic
    //domain, as opposed to ipDomainPat, shown above.
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
	//var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
    //Finally, let's start trying to figure out if the supplied address is valid. //
    //Begin with the coarse pattern to simply break up user@domain into
    //different pieces that are easy to analyze.
var matchArray=emailStr.match(emailPat)
if (matchArray==null) {
    //Too many/few @'s or something; basically, this address doesn't
    //even fit the general mould of a valid e-mail address.
	alert("Please enter Correct Email address")
	return false
}
var user=matchArray[1]
var domain=matchArray[2]
    // See if "user" is valid 
if (user.match(userPat)==null) {
    // user is not valid
   	alert("Please enter Correct Email address")
    return false
}

//if the e-mail address is at an IP address (as opposed to a symbolic host name) 
//make sure the IP address is valid.

var IPArray=domain.match(ipDomainPat)
if (IPArray!=null) {
    // this is an IP address
	  for (var i=1;i<=4;i++) {
	    if (IPArray[i]>255) {
	        alert("Destination IP address is invalid!")
		return false
	    }
    }

}

// Domain is symbolic name
var domainArray=domain.match(domainPat)
if (domainArray==null) {
	alert("The domain name doesn't seem to be valid.")
    return false
}

    //domain name seems valid, but now make sure that it ends in a
    //three-letter word (like com, edu, gov) or a two-letter word,
    //representing country (uk, nl), and that there's a hostname preceding 
    //the domain or country.

    //Now we need to break up the domain to get a count of how many atoms it consists of.
var atomPat=new RegExp(atom,"g")
var domArr=domain.match(atomPat)
var len=domArr.length
if (domArr[domArr.length-1].length<2 || domArr[domArr.length-1].length>4) {
   // the address must end in a two letter or three letter word.
   alert("The email address must end in a two to three-letter domain after the dot.")
   return false
}

// Make sure there's a host name preceding the domain.
if (len<2) {
   var errStr="This address is missing a hostname!"
   alert(errStr)
   return false
}

// If we've gotten this far, everything's valid!
return true;
}


function checkAll()
{
	if(document.frmTech.name.value=="")
	{
		alert("Please enter name");
		document.frmTech.name.focus();
		return false;
	}
	else if(check_special_chars(document.frmTech.name.value,'Name')==false)
	{
		document.frmTech.name.focus();
		return false;
	}
	else if(document.frmTech.emailAddress.value=="")
	{
		alert("Please enter Email Address");
		document.frmTech.emailAddress.focus();
		return false;
	}
	else if(emailCheck1(document.frmTech.emailAddress.value)==false)
	{
		document.frmTech.emailAddress.focus();
		return false;
	}
	else if(document.frmTech.phone.value=="")
	{
		alert("Please enter Phone number");
		document.frmTech.phone.focus();
		return false;
	}
	else if(document.frmTech.description.value == "")
	{
		alert("Please enter description");
		document.frmTech.description.focus();
		return false;
	}
	else if(check_scriptTag(document.frmTech.description.value) == false)
	{
		alert("Description is not valid.");
		document.frmTech.description.focus();
		return false;
	}
	else if(document.frmTech.image_text.value=="")
	{
		alert("Please enter Verification code");
		document.frmTech.image_text.focus();
		return false;
	}
}

// Function for Hide / show Product input text on blur on header

    function clearText(theField)
    {
      if (theField.defaultValue == theField.value && theField.value=="Product")
      theField.value = '';
    }

    function addText(theField)
    {
		if (theField.value == '')
		theField.value = theField .defaultValue;
    }


function checkAllFields()
{
      if(document.frmAddress.companyname.value=='')
      {
        alert('Please enter companyname.'); 
        document.frmAddress.companyname.focus();
        return false;
      }
      else if(check_special_chars(document.frmAddress.companyname.value,'companyname')==false)
      {
		document.frmAddress.companyname.value='';
        document.frmAddress.companyname.focus();
        return false;
      }
      else if(document.frmAddress.fullname.value=='')
      {
        alert('Please enter fullname.'); 
        document.frmAddress.fullname.focus();
        return false;
      }
      else if(check_special_chars(document.frmAddress.fullname.value,'fullname')==false)
      {
		document.frmAddress.fullname.value='';
        document.frmAddress.fullname.focus();
        return false;
      }
      else if(document.frmAddress.address1.value=='')
      {
        alert('Please enter address1.'); 
        document.frmAddress.address1.focus();
        return false;
      }
      else if(check_special_chars(document.frmAddress.address1.value,'address1')==false)
      {
		document.frmAddress.address1.value='';
        document.frmAddress.address1.focus();
        return false;
      }
	  else if(check_special_chars(document.frmAddress.address2.value,'address2')==false)
      {
		document.frmAddress.address2.value='';
        document.frmAddress.address2.focus();
        return false;
      }
      else if(document.frmAddress.city.value=='')
      {
        alert('Please enter city.'); 
        document.frmAddress.city.focus();
        return false;
      }
	  else if(check_special_chars(document.frmAddress.city.value,'city')==false)
      {
		document.frmAddress.city.value='';
        document.frmAddress.city.focus();
        return false;
      }
	else if(check_special_chars(document.frmAddress.state.value,'state')==false)
     {
		document.frmAddress.state.value='';
        document.frmAddress.state.focus();
        return false;
      }
      else if(document.frmAddress.zip.value=='')
      {
        alert('Please enter zipcode.'); 
        document.frmAddress.zip.focus();
        return false;
      }
	else if(check_special_chars(document.frmAddress.zip.value,'zipcode')==false)
	{
 		document.frmAddress.zip.focus();
        return false;
	}
      else if(document.frmAddress.country.selectedIndex ==0)
	  {
        alert('Select country.'); 
        document.frmAddress.country.focus();
        return false;
	  }
      else if(document.frmAddress.phone.value=='')
      {
        alert('Please enter phone.'); 
        document.frmAddress.phone.focus();
        return false;
      }
      else if(document.frmAddress.email.value=='')
      {
        alert('Please enter email.'); 
        document.frmAddress.email.focus();
        return false;
      }
      else if(emailCheck1(document.frmAddress.email.value)==false)
      {
		document.frmAddress.email.value='';
        document.frmAddress.email.focus();
        return false;
      }
}


function check_special_chars(str,fieldname) // allow , # )( / -'!.
{
    //var iChars = "!@#$%^&*()+=-[]\\\';,./{}|\":<>?/";
    var iChars = "@$%^&*+=[]\\;/{}|\":<>?";
    for (var i = 0; i < str.length; i++) {
  	if (iChars.indexOf(str.charAt(i)) != -1) {
  	alert (" " + fieldname + " is not valid.");
  	return false;
  	}
  }

}

function check_scriptTag(string)	// for address field.
{
      var Comments;
      Comments=string;
      Comments=Comments.toLowerCase();
      var matchPos = Comments.search('<');
      var matchPos1 = Comments.search('&lt;');
      var matchPos2 = Comments.search('>');
      var matchPos3 = Comments.search('&gt;');
      if(matchPos != -1 || matchPos1 != -1 || matchPos2 != -1 || matchPos3 != -1)
      {
        return false;								
      }
}

function checkInt(evt) {
    evt = (evt) ? evt : window.event
    var charCode = (evt.which) ? evt.which : evt.keyCode
    //if (charCode > 31 && (charCode < 48 || charCode > 57))
    if (charCode > 31 && charCode != 43 && charCode != 45 && charCode != 8 && (charCode < 48 || charCode > 57))  
    {
        status = "This field accepts numbers only."
        return false
    }
    status = ""
    return true
}

function check_special_charsOnCard(str,fieldname) 
{
    var iChars = "!@#$%^&*()+=[]\\\';,./{}|\":<>?";

    for (var i = 0; i < str.length; i++) {
  	if (iChars.indexOf(str.charAt(i)) != -1) {
  	alert (" " + fieldname + " is not valid.");
  	return false;
  	}
  }

}

function LegalStuff()
{
	alert(document.lsfrm.lsmsg.value);
}
