	var renderStartTime = new Date();

    function popup(url) {
	  if (arguments[1]) {
	    w = arguments[1];
	  } else {
	  	w = 500;
	  }
      var h=Math.min(600,screen.height-50);
      window.open(arguments[0],'popup','width='+w+',height='+h+',toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1');
return false;	  
    }

    function popUp(url) {
	  if (arguments[1]) {
	    w = arguments[1];
	  } else {
	  	w = 650;
	  }
      var h=Math.min(600,screen.height-50);
      window.open(arguments[0],'popUp','width='+w+',height='+h+',toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1');
return false;	  
    }

    function popupfaq(url) {
	  if (arguments[1]) {
	    w = arguments[1];
	  } else {
	  	w = 650;
	  }
      var h=Math.min(600,screen.height-50);
      window.open(arguments[0],'popupfaq','width='+w+',height='+h+',toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1'); 	  
    }



    function focusField(name) {
      for(i=0; i < document.forms.length; ++i) {
        var obj = document.forms[i].elements[name];
        if (obj && obj.focus) {obj.focus();}
      }
    }

    function selectField(name) {
      for(i=0; i < document.forms.length; ++i) {
        var obj = document.forms[i].elements[name];
        if (obj && obj.focus){obj.focus();} 
        if (obj && obj.select){obj.select();}
      }
    }

    function limitField(name, maxlimit) {
      for(i=0; i < document.forms.length; ++i) {
        var obj = document.forms[i].elements[name];
        if (obj) {
          if (obj.value.length > maxlimit) {
            obj.value = obj.value.substring(0, maxlimit);
          }
        }
      }
    }

    function limitFieldById(id, maxlimit) {
      if (document.getElementById) {
        var obj = document.getElementById(id);
        if (obj && (obj.value.length > maxlimit)) {
          obj.value = obj.value.substring(0, maxlimit);
        }
      }
    }

	function switchSearchBox ($on) {
		if ($on == 'SP') {
			document.getElementById('SLtab').src = '/images/searchbox/searchboxTabSLOff.gif';
			document.getElementById('SPtab').src = '/images/searchbox/searchboxTabSPOn.gif';
			document.getElementById('searchSlogan').src = '/images/searchbox/searchboxsloganSP.gif';
			document.getElementById('searchSlogan').alt = 'Where Salespeople Click and Connect... Instantly!';
			document.getElementById('SPtypes').style.display = 'inline';
			document.getElementById('advSrch').style.display = 'inline';
			document.searchBox.SPtypeSelect.options.selected = false;
			document.getElementById('advSrchContainer').colspan = 3;
			document.searchBox.action = '/alpha/cpz.php?fr=4';
		} else {
			document.getElementById('SLtab').src = '/images/searchbox/searchboxTabSLOn.gif';
			document.getElementById('SPtab').src = '/images/searchbox/searchboxTabSPOff.gif';
			document.getElementById('searchSlogan').src = '/images/searchbox/searchboxsloganSL.gif';
			document.getElementById('searchSlogan').alt = 'Get Qualified Sales Leads now!';
			document.getElementById('SPtypes').style.display = 'none';
			document.getElementById('advSrch').style.display = 'none';
			for (var i = 0; i < document.searchBox.SPtypeSelect.length; i++) {
			document.searchBox.SPtypeSelect.options[i].selected = false; }
			document.getElementById('advSrchContainer').colspan = 2;
			document.searchBox.action = '/alpha/cpz.php?l=12';
		}
	}
    
	function checkFormatEdit () {
		mySelect = document.forms['regindna'].country;
		currCountry = mySelect.options[mySelect.selectedIndex].value;
		if (currCountry <= 2) {
			document.getElementById('addressNA').style.display = 'block';
			document.forms['regindna'].address.rows = 3;
		} else {
			document.getElementById('addressNA').style.display = 'none';
			document.forms['regindna'].address.rows = 5;
		}		
	}
	function checkFormat () {
		
		mySelect = document.forms['regindna'].country;
		currCountry = mySelect.options[mySelect.selectedIndex].value;
		if (currCountry <= 2) {
			if (document.getElementById('stateNA')) document.getElementById('stateNA').style.display = 'block';
			if (document.getElementById('zipNA')) document.getElementById('zipNA').style.display = 'block';
			if (document.getElementById('stateNA2')) document.getElementById('stateNA2').style.display = 'block';
			if (document.getElementById('zipNA2')) document.getElementById('zipNA2').style.display = 'block';
			if (document.getElementById('phoneINT')) document.getElementById('phoneINT').style.display = 'none';
			if (document.getElementById('phoneNA')) document.getElementById('phoneNA').style.display = 'block' ;
			document.forms['regindna'].address.rows = 3;
			
		} else {
			document.getElementById('stateNA').style.display = 'none';
			document.getElementById('zipNA').style.display = 'none';
			document.getElementById('stateNA2').style.display = 'none';
			document.getElementById('zipNA2').style.display = 'none';
			document.getElementById('phoneINT').style.display = 'block';
			document.getElementById('phoneNA').style.display = 'none';
			document.forms['regindna'].address.rows = 5;
		}
	}	

	function showHide(inID) {
	     if (document.getElementById(inID).style.display == 'none') {
	          document.getElementById(inID).style.display = 'block';
	     } else {
	          document.getElementById(inID).style.display = 'none';
	     }
	}

    function getStyleObject(objectId) {
      // cross-browser function to get an object's style object given its id
      if(document.getElementById && document.getElementById(objectId)) {
  	  // W3C DOM
	  return document.getElementById(objectId).style;
      } else if (document.all && document.all(objectId)) {
 	  // MSIE 4 DOM
 	  return document.all(objectId).style;
      } else if (document.layers && document.layers[objectId]) {
	  // NN 4 DOM.. note: this won't find nested layers
	  return document.layers[objectId];
      } else {
	  return false;
      }
    } 

    function getObject(objectId) {
      // cross-browser function to get an object given its id
      // If you need to change the style of an object or its display/visibility
      // use one of the other methods in this template
      // This function won't work for NN 4 DOM ==> Only use internally
      if(document.getElementById && document.getElementById(objectId)) {
  	  // W3C DOM
	  return document.getElementById(objectId);
      } else if (document.all && document.all(objectId)) {
 	  // MSIE 4 DOM
 	  return document.all(objectId);
      } else {
	  return false;
      }
    }

    function changeObjectVisibility(objectId, newVisibility) {
      // get a reference to the cross-browser style object and make sure the object exists
      var styleObject = getStyleObject(objectId);
      if(styleObject) {
	  styleObject.visibility = newVisibility;
	  return true;
      } else {
	 // we couldn't find the object, so we can't change its visibility
	 return false;
      }
    } 


    function changeObjectDisplay(objectId, newDisplay) {
      // get a reference to the cross-browser style object and make sure the object exists
      var styleObject = getStyleObject(objectId);
      if(styleObject) {
	  styleObject.display = newDisplay;
	  return true;
      } else {
	  // we couldn't find the object, so we can't change its visibility
	  return false;
      }
    }

    function setOnOff(id1, id2) {
      changeObjectDisplay(id1, 'block');
      changeObjectDisplay(id2, 'none');
    }

  

  
    function ga(o,e){var a,f,g,h,p,r,t; if (document.getElementById){a=o.id.substring(1); p = "";r = "";g = e.target;if (g) { t = g.id;f = g.parentNode;if (f) {p = f.id;h = f.parentNode;if (h) r = h.id;}} else{h = e.srcElement;f = h.parentNode;if (f) p = f.id;t = h.id;}if (t==a || p==a || r==a) return true;location.href=document.getElementById(a).href}}

    // cross platform equiv. to document.getElementById
    function gGetElementById(s) {
      var o = (document.getElementById ? document.getElementById(s) : document.all[s]);
      return o == null ? false : o;
    }

    // simple hide/display
    function toggleVisibility(id) {
      var o = gGetElementById(id);
      if (o != null) {
        if (o.style.display == 'none')
          o.style.display = 'block';
        else
          o.style.display = 'none';
      }
    }

    function isGoodBrowser() {
     var ua=navigator.userAgent;
     var isGood=0;
       if ((ua.indexOf("MSIE 5")!=-1) 
 	|| (ua.indexOf("MSIE 6")!=-1) 
	|| (ua.indexOf("Mozilla/5")!=-1) )
	{ 
	  if (ua.indexOf("Opera")==-1){
	    var isGood = 1;
	}
      }
	  return isGood;
    }
    
 

      function modifyText(id, text) {
        if (document.getElementById) {
          obj = document.getElementById(id);
          obj.childNodes[0].data = text;
        }
      }
      function modifyTextNotClear(id, text) {
        if (document.getElementById && text != '') {
          obj = document.getElementById(id);
          obj.childNodes[0].data = text;
        }
      }
      function filterVisibleURL(text) {
        return text.replace(/^\s*/, '').replace(/\s*$/, '').replace(/^https?:\/\//, '').replace(/\/.*/, '').replace(/:[0-9]+$/, '');
      }
      
      function copyValue(destination, source) {
        if (document.getElementById) {
          if (document.getElementById(destination) && document.getElementById(source)) {
	    if ((document.getElementById(destination).value == '') && (document.getElementById(source).value != '')) {
	      document.getElementById(destination).value = document.getElementById(source).value;
	    }
	  }
        }
      }

	  function add(a,b){
	   c=parseFloat(a)+parseFloat(b)+0.00;
	   c=c*Math.pow(2,2);
	   c=Math.round(c);
	   c=c/Math.pow(10,2);
	   d='USD$'+ c;
	  return d;
	  }

	  // 22/06/2005
	  function getSelectedValues (select) {
										  var r = new Array();
										  //document.all['folderbbb'].value+=a;

										  for (var i = 0; i < document.all[select].options.length; i++)
											if (document.all[select].options[i].selected)
											  r[r.length] = document.all[select].options[i].value;
										  return r;
											}
	function	prepareForSend(a,b){
	v=getSelectedValues(a);
	g=getSelectedValues(b);
	d='&v='+v+'&g='+g;

	p = xmlHTTPRequest('http://192.168.1.2/md5.php?in=1'+d); 
	
alert(p);
	}


/// 4/7/2005




var checkflag = "false";
function check(field) {
	if (checkflag == "false") {
		for (i = 0; i < field.length; i++) {
			field[i].checked = true;
		}
		checkflag = "true";
	} else {
		for (i = 0; i < field.length; i++) {
			field[i].checked = false; 
		}
		checkflag = "false";
	}
}

function doPopup() {
window.open("/banner.php", "Survey","left=300,top=300,width=500,height=600,status=no,toolbar=no,menubar=no,location=no,resizable=yes");

}


  //ID Helper DHTML module toggle
  function toggleInstructions() {
  	if(oBw.ie5||oBw.ns6){  //Disable function in unsupported browsers
    	Istate = document.getElementById('instructions').style.display;
    		if (Istate=='none') {
      			Istate='block';
    		}
    		else {
      			Istate='none';
    		}

    	document.getElementById('instructions').style.display=Istate;
  		}
  	}
  function toggleInstructionsOn() {
  	if(oBw.ie5||oBw.ns6){  //Disable function in unsupported browsers
    	Istate = document.getElementById('instructions').style.display;
    		if (Istate=='none') {
      			Istate='block';
    		}
    		else {
      			Istate='block';
    		}
    	document.getElementById('instructions').style.display=Istate;
		}
  	}
   //Toggle Alt Email Mandatory notation
   //switch layers for different browsers
	
	function hidelayer(lay) {
		
	if (ie4) {document.all[lay].style.visibility = "hidden";}
	if (ns4) {document.layers[lay].visibility = "hide";}
	if (ns6) {document.getElementById([lay]).style.display = "none";}
	}
	
	function showlayer(lay) {
	if (ie4) {document.all[lay].style.visibility = "visible";}
	if (ns4) {document.layers[lay].visibility = "show";}
	if (ns6) {document.getElementById([lay]).style.display = "block";}
	}



function sss2(a){
//document.all['folderbbb'].value+=a;
checked_length=0;
	for (i = 0; i < themyform.elements['list[]'].length; i++) {
					if(themyform.elements['list[]'][i].checked == true){
					checked_length++;	
					}
	}
if(checked_length>0)//if  somethng checked 
		themyform.submit();
	else
		alert("Nothing to move.\nPlease check at least one contact.");
		 themyform.elements['gid'].selectedIndex=0;
		 return false;
}

function confirm_addition(){
return alert('----------------------------------------------------------------------------------------\n\n'+'Selected Contact has been added to Your Shopping Basket successfully!\n\n'+'Thank you for shopping with us !\n\n'+'----------------------------------------------------------------------------------------\n');
}
/////////

//AlexG functions
// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;

var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);

function checkForm() {

  formErrors = false;
 if (document.post.commenttext.value.length < 2){
    formErrors = "You must enter a Comment when posting.";
  }
  if (document.post.commentsubject.value.length < 2){
    formErrors = "You must enter a Subject when posting.";
  }
  if (formErrors) {
    alert(formErrors);
    return false;
  } else {
    //bbstyle(-1);
    //formObj.preview.disabled = true;
    //formObj.submit.disabled = true;
    return true;
  }
}
// Startup variables
var imageTag = false;
var theSelection = false;


// Helpline messages
b_help = "Bold text: [b]text[/b]  (alt+b)";
i_help = "Italic text: [i]text[/i]  (alt+i)";
u_help = "Underline text: [u]text[/u]  (alt+u)";
q_help = "Quote text: [quote]text[/quote]  (alt+q)";
c_help = "Code display: [code]code[/code]  (alt+c)";
l_help = "Unodered list: [list]text[/list] (alt+l)";
oa_help = "Ordered list: [list=a]text[/list]  (alt+o)";
o1_help = "Ordered list: [list=1]text[/list]  (alt+1)";
p_help = "Insert normal image: [img]http://image_url[/img]  (alt+r)";
pr_help = "Insert right aligned image text wrapped : [imgr]http://image_url[/imgr]  (alt+pr)";
pl_help = "Insert left aligned image text wrapped : [imgl]http://image_url[/imgl]  (alt+pl)";
w_help = "Insert URL: [url]http://url[/url] or [url=http://url]URL text[/url]  (alt+w)";
a_help = "Close all open bbCode tags";
s_help = "Font color: [color=red]text[/color]  Tip: you can also use color=#FF0000";
f_help = "Font size: [size=x-small]small text[/size]";
li_help = "list item: [*]text[/*] (alt+*)";

// Define the bbCode tags
bbcode = new Array();
//                         2             4            6                  8                  10                 12                    14                 16                 18           20                   22               24
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=a]','[/list]' ,'[img]','[/img]', '[url]','[/url]','[*]','[/*]','[list=1]','[/list]','[imgr]','[/imgr]' ,'[imgl]','[/imgl]');
imageTag = false;

// Shows the help messages in the helpline window
function helpline(help) {
  document.post.helpbox.value = eval(help + "_help");
}


// Replacement for arrayname.length property
function getarraysize(thearray) {
  for (i = 0; i < thearray.length; i++) {
    if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
      return i;
    }
  return thearray.length;
}

// Replacement for arrayname.push(value) not implemented in IE until version 5.5
// Appends element to the array
function arraypush(thearray,value) {
  thearray[ getarraysize(thearray) ] = value;
}

// Replacement for arrayname.pop() not implemented in IE until version 5.5
// Removes and returns the last element of an array
function arraypop(thearray) {
  thearraysize = getarraysize(thearray);
  retval = thearray[thearraysize - 1];
  delete thearray[thearraysize - 1];
  return retval;
}


function checkForm() {
  formErrors = false;
  if (document.post.commentname.value.length < 2){
    formErrors = "You must enter a Name when posting.";
  }
  if (document.post.commenttext.value.length < 2){
    formErrors = "You must enter a Comment when posting.";
  }
  if (document.post.commentsubject.value.length < 2){
    formErrors = "You must enter a Subject when posting.";
  }
  if (formErrors) {
    alert(formErrors);
    return false;
  } else {
    //bbstyle(-1);
    //formObj.preview.disabled = true;
    //formObj.submit.disabled = true;
    return true;
  }
}

function emoticon(text) {
  var txtarea = document.post.commenttext;
  text = ' ' + text + ' ';
  if (txtarea.createTextRange && txtarea.caretPos) {
    var caretPos = txtarea.caretPos;
    caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
    txtarea.focus();
  } else {
    txtarea.value  += text;
    txtarea.focus();
  }
}

function bbfontstyle(bbopen, bbclose) {
  var txtarea = document.post.commenttext;

  if ((clientVer >= 4) && is_ie && is_win) {
    theSelection = document.selection.createRange().text;
    if (!theSelection) {
      txtarea.value += bbopen + bbclose;
      txtarea.focus();
      return;
    }
    document.selection.createRange().text = bbopen + theSelection + bbclose;
    txtarea.focus();
    return;
  }
  else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
  {
    mozWrap(txtarea, bbopen, bbclose);
    return;
  }
  else
  {
    txtarea.value += bbopen + bbclose;
    txtarea.focus();
  }
  storeCaret(txtarea);
}


function bbstyle(bbnumber) {
  var txtarea = document.post.commenttext;

  txtarea.focus();
  donotinsert = false;
  theSelection = false;
  bblast = 0;

  if (bbnumber == -1) { // Close all open tags & default button names
    while (bbcode[0]) {
      butnumber = arraypop(bbcode) - 1;
      txtarea.value += bbtags[butnumber + 1];
      buttext = eval('document.post.addbbcode' + butnumber + '.value');
      eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
    }
    imageTag = false; // All tags are closed including image tags :D
    txtarea.focus();
    return;
  }

  if ((clientVer >= 4) && is_ie && is_win)
  {
    theSelection = document.selection.createRange().text; // Get text selection
    if (theSelection) {
      // Add tags around selection
      document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
      txtarea.focus();
      theSelection = '';
      return;
    }
  }
  else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
  {
    mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
    return;
  }

  // Find last occurance of an open tag the same as the one just clicked
  for (i = 0; i < bbcode.length; i++) {
    if (bbcode[i] == bbnumber+1) {
      bblast = i;
      donotinsert = true;
    }
  }

  if (donotinsert) {    // Close all open tags up to the one just clicked & default button names
    while (bbcode[bblast]) {
        butnumber = arraypop(bbcode) - 1;
        txtarea.value += bbtags[butnumber + 1];
        buttext = eval('document.post.addbbcode' + butnumber + '.value');
        eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
        imageTag = false;
      }
      txtarea.focus();
      return;
  } else { // Open tags

    if (imageTag && (bbnumber != 14)) {    // Close image tag before adding another
      txtarea.value += bbtags[15];
      lastValue = arraypop(bbcode) - 1;  // Remove the close image tag from the list
      document.post.addbbcode14.value = "Img";  // Return button back to normal state
      imageTag = false;
    }

    // Open tag
    txtarea.value += bbtags[bbnumber];
    if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
    arraypush(bbcode,bbnumber+1);
    eval('document.post.addbbcode'+bbnumber+'.value += "*"');
    txtarea.focus();
    return;
  }
  storeCaret(txtarea);
}

// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{
  var selLength = txtarea.textLength;
  var selStart = txtarea.selectionStart;
  var selEnd = txtarea.selectionEnd;
  if (selEnd == 1 || selEnd == 2)
    selEnd = selLength;

  var s1 = (txtarea.value).substring(0,selStart);
  var s2 = (txtarea.value).substring(selStart, selEnd)
  var s3 = (txtarea.value).substring(selEnd, selLength);
  txtarea.value = s1 + open + s2 + close + s3;
  return;
}

// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
function storeCaret(textEl) {
  if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}
//forms validation starts
function trimString (str) {
  str = this != window? this : str;
  return str.replace(/^\s+/g, '').replace(/\s+$/g, '');
}

function fieldControlOn(defaultVal, curVal, idName) {
	if (defaultVal == curVal) { //if the user just cliecked, we put a blank in place.
		document.getElementById(idName).value = '';
	}
	if (idName == 'password' || idName == 'password2' || idName == 'pass')  {
		document.getElementById(idName+'xyz').innerHTML = '<input type="password" tabindex="4" name="'+idName+'" id="'+idName+'" class="new_text"/>';
		document.getElementById(idName).focus();
	}
}

function fieldControlOff(defaultVal, curVal, idName) {
	if (curVal == '') { //if the user just cliecked, we put a blank in place.
		document.getElementById(idName).value = defaultVal;
	} else if (idName == 'password' || idName == 'password2' || idName == 'pass')  {
		document.getElementById(idName).type = 'password';
	}
}

function validateForm(formname)
{
		function emailcheck(str) {

			var at="@"
			var dot="."
			var lat=str.indexOf(at)
			var lstr=str.length
			var ldot=str.indexOf(dot)
				
					if (str.indexOf(at)==-1){
					//alert("The eMail address '@' convention appears to be invalid.")
					return false
					}
					if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
					//alert("The eMail address '@' convention appears to be invalid.")
					return false
					}
					if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
					//alert("The eMail address 'dot' convention appears to be invalid.")
					return false
					}
					if (str.indexOf(at,(lat+1))!=-1){
					//alert("The eMail address '@' convention appears to be invalid.")
					return false
					}
					if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
					//alert("The eMail address 'dot' convention appears to be invalid.")
					return false
					}
					if (str.indexOf(dot,(lat+2))==-1){
					//alert("The eMail address 'dot' convention appears to be invalid.")
					return false
					}
						if (str.indexOf(" ")!=-1){
					//alert("The eMail address spacing convention appears to be invalid.")
					return false
					}

				return true
		}

		function validateUSZIP(field) {
				var valid = "0123456789-";
				var hyphencount = 0;

				if (field.length!=5 && field.length!=10) {
				//alert("Please enter your 5 digit or 5 digit+4 zip code.");
				return false;
				}
				for (var i=0; i < field.length; i++) {
					temp = "" + field.substring(i, i+1);
				if (temp == "-") hyphencount++;
						if (valid.indexOf(temp) == "-1") {
							alert("Invalid characters in your zip code.  Please try again.");
					return false;
				}
			if ((hyphencount > 1) || ((field.length==10) && ""+field.charAt(5)!="-")) {
					//alert("The hyphen character should be used with a properly formatted 5 digit+four zip code, like '12345-6789'.   Please try again.");
					return false;
					}
				}
			return true;
		}
  	
	
	formErrors = "";
	switch(formname) {
        case "regindnas": //New registration individuals north America

				if (trimString(document.forms['regindna'].password.value) == ""){
						formErrors+="Password is a mandatory field\n";
					}
				if (trimString(document.forms['regindna'].password2.value) == ""){
						formErrors+="You must repeat Password\n";
					}
				if (trimString(document.forms['regindna'].password.value)!= trimString(document.forms['regindna'].password2.value)){
						formErrors+="'Password' and 'Repeat Password' must be identical\n";
					}
				if ( !((document.forms['regindna'].password.value.match(/\d/)) && (document.forms['regindna'].password.value.match(/\D/))) ) {
		        		formErrors+= "The password must contain at least one number\n";
				}
				if (document.forms['regindna'].password.value.length<7 || document.forms['regindna'].password.value.length>30){
						formErrors+="Password must be at least 7 characters, not to exceed 30 characters\n";
					}

				/*if (document.forms['regindna'].elements['recover'].selectedIndex==0){
							formErrors+="Year of Birth is a mandatory field\n";
					}*/
				/*if (document.forms['regindna'].elements['title'].selectedIndex==0){
							formErrors+= "Title is a mandatory field\n";
					}*/
				if (trimString(document.forms['regindna'].fname.value) == ""){
							formErrors+="First name is a mandatory field\n";
				}
				if (trimString(document.forms['regindna'].lname.value) == ""){
							formErrors+="Last name is a mandatory field\n";
				}
				if (typeof(document.forms['regindna'].postal_code) != "undefined" && trimString(document.forms['regindna'].postal_code.value) == ""){
							formErrors+="Postal Code is a mandatory field\n";
				}
				if (typeof(document.forms['regindna'].zip) != "undefined" && trimString(document.forms['regindna'].zip.value) == ""){
							formErrors+="Zip Code is a mandatory field\n";
				}
				if (typeof(document.forms['regindna'].state) != "undefined" && trimString(document.forms['regindna'].state.value) == -1){
							formErrors+="State is a mandatory field\n";
				}

				if (document.forms['regindna'].country && document.forms['regindna'].country.value <= 2) {
					if (trimString(document.forms['regindna'].area_codeNA.value) == "" || document.forms['regindna'].area_codeNA.value.length<3){
						formErrors+= "Area code is invalid\n";
				}
				if(document.forms['regindna'].phoneNA){	
					if (trimString(document.forms['regindna'].phoneNA.value) == "" || document.forms['regindna'].phoneNA.value.length<7){
						formErrors+= "Phone is invalid\n";
					}
				}	
					/*if (document.forms['regindna'].elements['state'].selectedIndex==0){
						formErrors+= "State/Province is a mandatory field\n";
					}*/
					if(document.forms['regindna'].country){	
						if(document.forms['regindna'].country.value==1){				
							if (!validateUSZIP(document.forms['regindna'].zip.value)){
								formErrors+= "ZIP/Postal code is invalid\n";
							}
						}
						else if(document.forms['regindna'].country.value==2){
							if (document.forms['regindna'].zip.value == "" || document.forms['regindna'].zip.value.length < 6){
							formErrors+= "ZIP/Postal code is invalid\n";
							}
						}
					}	
				} 
				//else {
					
					/*if (trimString(document.forms['regindna'].phoneINT.value) == ""){
						formErrors+= "Phone is invalid\n";
					}*/
					/*if (document.forms['regindna'].INTcountryCode.value == "") {
						formErrors+= "You must select your telephone country code\n";
					}*/
				//}
				if (!emailcheck(document.forms['regindna'].email.value)){
				
							formErrors+="Email is  invalid\n";
					}
				/*if (document.forms['regindna'].elements['vertical[]'].selectedIndex==-1){
							formErrors+= "Vertical Industry is a mandatory field\n";
					}*/
				/*if (document.forms['regindna'].elements['coverage[]'].selectedIndex==-1){
							formErrors+= "Sales Territory Coverage is a mandatory field\n";
					}*/
				/*if (document.forms['regindna'].elements['sales_type[]'].selectedIndex==-1){
							formErrors+= "Sales Type is a mandatory field\n";
					}*/
				/*if (trimString(document.forms['regindna'].address.value) == ""){
							formErrors+= "Address is a mandatory field\n";
					}*/
				/*if (trimString(document.forms['regindna'].city.value) == ""){
							formErrors+= "City is a mandatory field\n";
					}*/

				if (!document.forms['regindna'].agree.checked){
				
						formErrors+= "You must agree to Terms and conditions in order to proceed\n";
				}
							
				break;
				//End new registration
			 case "regindna": //New registration individuals north America
		
				if (trimString(document.forms['regindna'].password.value) == ""){
							formErrors = "Password is a mandatory field\n";
					}
				if (trimString(document.forms['regindna'].password2.value) == ""){
							formErrors+="You must repeat Password\n";
					}
				if (trimString(document.forms['regindna'].password.value)!= trimString(document.forms['regindna'].password2.value)){
							formErrors+="'Password' and 'Repeat Password' must be identical\n";
					}
				if (document.forms['regindna'].password.value.length<7 || document.forms['regindna'].password.value.length>30){
							formErrors+= "Password must be at least 7 characters, not to exceed 30 characters\n";
					}

				if (document.forms['regindna'].elements['recover'].selectedIndex==0){
							formErrors+= "Year of Birth is a mandatory field\n";
					}
				if (trimString(document.forms['regindna'].fname.value) == ""){
							formErrors+= "First name is a mandatory field\n";
					}
				if (trimString(document.forms['regindna'].lname.value) == ""){
							formErrors+= "Last name is a mandatory field\n";
					}
				if (typeof(document.forms['regindna'].postal_code) != "undefined" && trimString(document.forms['regindna'].postal_code.value) == ""){
							formErrors+="Postal Code is a mandatory field\n";
				}
				if (typeof(document.forms['regindna'].zip) != "undefined" && trimString(document.forms['regindna'].zip.value) == ""){
							formErrors+="Zip Code is a mandatory field\n";
				}
				if (typeof(document.forms['regindna'].state) != "undefined" && trimString(document.forms['regindna'].state.value) == -1){
							formErrors+="State is a mandatory field\n";
				}

					if (document.forms['regindna'].country.value <= 2) {
					if (trimString(document.forms['regindna'].area_codeNA.value) == "" || document.forms['regindna'].area_codeNA.value.length<3){
						formErrors+= "Area code is invalid\n";
					}
					if (trimString(document.forms['regindna'].phoneNA.value) == "" || document.forms['regindna'].phoneNA.value.length<7){
						formErrors+= "Phone is invalid\n";
					}
					if (document.forms['regindna'].elements['state'].selectedIndex==0){
						formErrors+= "State/Province is a mandatory field\n";
					}

					if(document.forms['regindna'].country.value==1){				
						if (!validateUSZIP(document.forms['regindna'].zip.value)){
							formErrors+= "ZIP/Postal code is invalid\n";
						}
					}
					else if(document.forms['regindna'].country.value==2){
						if (document.forms['regindna'].zip.value == "" || document.forms['regindna'].zip.value.length < 6){
							formErrors+= "ZIP/Postal code is invalid\n";
						}
					}
				} 
				else {
					
					if (trimString(document.forms['regindna'].phoneINT.value) == ""){
						formErrors+= "Phone is invalid\n";
					}
					if (document.forms['regindna'].INTcountryCode.value == "") {
						formErrors+= "You must select your telephone country code\n";
					}
				}
				if (!emailcheck(document.forms['regindna'].email.value)){
							formErrors+= "Email is  invalid\n";
					}
				if (document.forms['regindna'].elements['vertical[]'].selectedIndex==-1){
							formErrors+= "Vertical Industry is a mandatory field\n";
					}
				if (document.forms['regindna'].elements['coverage[]'].selectedIndex==-1){
							formErrors+= "Sales Territory Coverage is a mandatory field\n";
					}
				if (document.forms['regindna'].elements['sales_type[]'].selectedIndex==-1){
							formErrors+= "Sales Type is a mandatory field\n";
					}
				if (trimString(document.forms['regindna'].address.value) == ""){
							formErrors+= "Address is a mandatory field\n";
					}
				if (trimString(document.forms['regindna'].city.value) == ""){
							formErrors+= "City is a mandatory field\n";
					}

				if (!document.forms['regindna'].agree.checked){
										formErrors+= "You must agree to Terms and conditions in order to proceed\n";
				}
								
				break;
				//End new registration
	
      	case "addlead" : //New Lead posting
				var productdescription = trimString(document.addlead.ProductDescription.value);
     		   	if (productdescription.length ==0){
							formErrors = "Product/Service description is a mandatory field\n";
				}
				break;
		case "updatelead" : //Update Lead details			
			   	if ( trimString(document.updatelead.ProductDescription.value) == ""){
							formErrors = "Product/Service description is a mandatory field\n";
				}
				break;
		case "addlisting" : //New Listing posting
			formErrors="";
			var email=trimString(document.addlead.email.value);
			var category= trimString(document.addlead.optone.value);
			var title = trimString(document.addlead.Title.value);
			var productdescription = trimString(document.addlead.Description.value);			
			var regions= document.getElementById("region[]");	
			
			if (!emailcheck(document.addlead.email.value)){
				formErrors+= "Email is  invalid\n";
			}
			if (category.length==0){
				formErrors+="Category is a mandatory field\n";						
			}
			if (title.length==0){
				formErrors+="Title is a mandatory field\n";						
			}
				
     		if (productdescription.length==0){
				formErrors+="Product/Service description is a mandatory field\n";
			}
			
			var i;
  			var count = 0;
  			for (i=0; i<regions.options.length; i++) {
    			if (regions.options[i].selected) {
      				count++;
    			}
 	 		}
			if(count==0)
				formErrors+="Region is a mandatory field\n";
			break;
		case "updatelisting" : //Update Listing 

				var title = trimString(document.updatelead.Title.value);
     		   	if (title.length ==0){
							formErrors = "Title is a mandatory field\n";
				}
				var productdescription = trimString(document.updatelead.ProductDescription.value);
     		   	if (productdescription.length ==0){
							formErrors = "Product/Service description is a mandatory field\n";
				}

    	default:
				
				break;
      }

	if (formErrors!="") {
		alert(formErrors);
		return false;
	}
	else 
	{
       return true;
	}
}
//forms validation ends
function teleport(where){
if(is_ie){
		window.location.href(where);
	}
	else if(is_nav){
		window.location.replace(where);
	}
}


function teleportselected() {
chosen = ""
len = document.gosearch.search.length

for (i = 0; i <len; i++) {
	if (document.gosearch.search[i].checked) {
	chosen = document.gosearch.search[i].value
 	}
}
	
	teleport(chosen); 

}

function blinker(blinkForm)
{
   if (document.forms[blinkForm].mySubmit.style.color == 'black') {
      document.forms[blinkForm].mySubmit.style.color='blue';
   } else {
      document.forms[blinkForm].mySubmit.style.color='black';
   }
   setTimeout("blinker('"+blinkForm+"')",700);
}

function submitOnce(useForm) {
	document.forms[useForm].mySubmit.value = 'Please Wait... Processing!';
	document.forms[useForm].mySubmit.disabled=true;
	document.forms[useForm].submit();
	return true;
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function leads_popUp(URL) {
	window.open(URL, "Attachment", 'resizable=yes, scrollbars=yes, toolbar=no, location=no, directories=no, status=no, menubar=no, copyhistory=no');
}

function leads_saveFile (fname)
{		
		oIFrm = document.getElementById('myIFrm');
		oIFrm.src = url;
		//alert(url);
		//window.onload = setTimeout('tryToDownload("test.rar")', 5*1000);
}