var reWS = /^\s+\$/
var reInt = /^\d+\$/

/* Checks if the string contains null or string length is zero */
function isEmpty(s) {
	return ((s == null) || (s.length == 0))
}

function isWS(s) {
	return (isEmpty(s));
}

function testEmail(src) {
	var regex = /^[a-zA-Z0-9._-]+@([a-zA-Z0-9.-]+\.)+[a-zA-Z0-9.-]{2,4}$/;
	return regex.test(src);
}

/* In selCountry drop down, if selected option is "Others" then txtCountryOther value is set to null */
function settextnull(){
	for(i=0; i < document.frmMain.selCountry.length ; i++){
		if (document.frmMain.selCountry.options[i].selected ==  true){
			if (document.frmMain.selCountry.options[i].text != "Other:"){
				document.frmMain.txtCountryOther.value = "";
			}
		}
	}
}


/* In selState drop down, if selected option is "Others" then txtStateOther value is set to null */
function settextnullstate(){
	for(i=0; i < document.frmMain.selState.length ; i++){
		if (document.frmMain.selState.options[i].selected ==  true){
			if (document.frmMain.selState.options[i].text != "Other:"){
				document.frmMain.txtStateOther.value = "";
			}
		}
	}
}



/*
browserCompatibility() checks for browser names & versions as it only supports IE 5.0 & above
and Netscape 6.0 & above
*/
function browserCompatibility() {
	var bName = navigator.appName;
	var bVer = navigator.appVersion;
	var useragent= navigator.userAgent ;
	if(bName=="Netscape"){
	if (useragent.indexOf("Netscape/")!="-1") {
	    //alert("Success");
	    return(true);
	}
	else{
	    alert("You are using an old version of Netscape. Use Netscape 7 or above. (" + useragent + ")");
	    window.open("http://www.netscape.com", "Netscape");
			document.location.href="Sic_Browser.jsp";
	}
	}
	else{
		useragent=useragent.split(";");
		    useragent[1]=useragent[1].replace("MSIE ",'');
		    useragent[1]=useragent[1].replace("MSIE ",'');
		    if(parseInt(useragent[1])>=5){
			//alert("You are using the correct version of IE");
			return(true);
		    }
		    else{
			alert("You are using Old browser. Kindly install Intenet Explorer 5 or above");
			//window.open("http://www.microsoft.com", "tinyWindow");
			history.back();
		    }
	   }
}



/* Function for trimming a string starts here */
/* ltrim() trims left spaces, if any,  of the given string */
function ltrim(argvalue) {
	while (1) {
		if (argvalue.substring(0, 1) != " ")
			break;
		argvalue = argvalue.substring(1, argvalue.length);
	}
	return argvalue;
}

/* rtrim() trims right spaces, if any,  of the given string */
function rtrim(argvalue) {
	while (1) {
		if (argvalue.substring(argvalue.length - 1,argvalue.length) != " ")
			break;
		argvalue = argvalue.substring(0, argvalue.length - 1);
	}
	return argvalue;
}

/* trim() invokes ltrim() & rtrim() for trimming left and right spaces of a given string */
function trim(argvalue) {
	var tmpstr = ltrim(argvalue);
	return rtrim(tmpstr);
}
/*  Function for trimming a string ends here */


function showtxtCategory() {
	if (document.frmMain.radCategory[8].checked) {
		document.getElementById("otherCategoryShow").style.visibility = "visible";
	} else {
		document.getElementById("otherCategoryShow").style.visibility = "hidden";
	}
}

function showTextBox2(){
var z = document.frmMain.Reseller.options[document.frmMain.Reseller.selectedIndex].value;
	if (z == "Other") {
		document.getElementById("reslyr1").style.visibility = "visible";
	} else {
		document.getElementById("reslyr1").style.visibility = "hidden";
	}
}

function showStateTextBox(){
var y = document.frmMain.selState.options[document.frmMain.selState.selectedIndex].value;
	if (y == "Other") {
		document.getElementById("otherstate").style.visibility = "visible";
		document.frmMain.txtStateOther.focus();
	} else {
		document.getElementById("otherstate").style.visibility = "hidden";
	}
}

function showCountryTextBox(){
var y = document.frmMain.selCountry.options[document.frmMain.selCountry.selectedIndex].value;
	if (y == "Other") {
		document.getElementById("othercountry").style.visibility = "visible";
		document.frmMain.txtCountryOther.focus();
	} else {
		document.getElementById("othercountry").style.visibility = "hidden";
	}
}

function getHelp(query) {
	if (!document.frmMain.chkSgnBC.checked)  {
		alert("You have chosen NOT to register for Brocade Community access.\n\nCheck the 'Yes, I want access to Brocade Community.' checkbox now if you want access to Brocade Community.\n\nContact connect@brocade.com if you require assistance.");
		return;
	}
}


 /* Function to disappear asterisk when checkbox is unchecked */
	function disappearAsterisk() {
		var locFrm = document.frmMain;
		if (locFrm.chkSgnBC.checked) {
		  	document.getElementById(1).style.visibility ='visible';
		  	document.getElementById(2).style.visibility ='visible';
		  	document.getElementById(3).style.visibility ='visible';
		  	document.getElementById(4).style.visibility ='visible';	
		  	document.getElementById(5).style.visibility ='visible';
		}
		else {
		  	document.getElementById(1).style.visibility ='hidden';
		  	document.getElementById(2).style.visibility ='hidden';
		  	document.getElementById(3).style.visibility ='hidden';
		  	document.getElementById(4).style.visibility ='hidden';
		  	document.getElementById(5).style.visibility ='hidden';
		  	locFrm.txtPassword.value='';
		  	locFrm.txtConfPassword.value='';
		  	locFrm.txtHintPwd.value='';
		  	locFrm.txtHintResp.value='';
		  	locFrm.txtAlias.value='';
		}
	}
	
function greyout(){
	   var f = document.frmMain;
	   if (!document.frmMain.chkSgnBC.checked) {				
		f.txtPassword.disabled = true;
		f.txtPassword.className = 'greybox';
		f.txtConfPassword.disabled = true;
		f.txtConfPassword.className = 'greybox';
		f.txtHintPwd.disabled = true;
		f.txtHintPwd.className = 'greybox';
		f.txtHintResp.disabled = true;
		f.txtHintResp.className = 'greybox';
		f.txtAlias.disabled = true;
		f.txtAlias.className = 'greybox';
	    }else{				
		f.txtPassword.disabled = false;
		f.txtPassword.className = 'nogreybox';
		f.txtConfPassword.disabled = false;
		f.txtConfPassword.className = 'nogreybox';
		f.txtHintPwd.disabled = false;
		f.txtHintPwd.className = 'nogreybox';
		f.txtHintResp.disabled = false;
		f.txtHintResp.className = 'nogreybox';
		f.txtAlias.disabled = false;
		f.txtAlias.className = 'nogreybox';
	    }
}

	
	
function chkDomain(src) {
var regex = /mcdata.com|cisco.com|emulex.com|maxxan.com|sandial.com|marantinetworks.com|andiamo.com|nishansystems.com|sanera.net|gadzoox.com|sbc.yahoo.com|@bigmailbox.net|@freeonline.com|@altavista.net|@angelfire.com|@netzero.com|@anti-social.com|@earthlink.net|@worldnet.att.net|@hotmail.com|@yahoo.com|@yahoo.co|@mail.com|@bigfoot.com|@webmail.bellsouth.net|@tgi.cjb.net|@collegeclub.com|@coolmail.net|@my-dejanews.com|@email.com|@smallbizmail.com|@eudoramail.com|@excite.com|@freeyellow.com|@collegemail.com|@geocities.com|@theglobe.com|@go.com|@gurlmail.com|@hotbot.com|@hotpop.com|@null.net|@infomak.com|@lycosmail.com|@mailcity.com|@mcafeemail.com|@pcpostal.com|@usa.net|@netscape.net|@dotexpress.com|@pobox.com|@poboxes.com|@quakemail.com|@rocketmail.com|@sofcom.com|@switchboardmail.com|@briefcase.com|@wowmail.com|@xoommail.com|@zdnetmail.com|@zyworld.com|@comcast.net|@address.com|@aussiemail.com.au|@bluebottle.com|@boardermail.com|@bolt.com|@canada.com|@canoemail.com|@animail.net|@moose-mail.com|@snail-mail.net|@whale-mail.com|@wildmail.com|@cashette.com|@catchamail.com|@centralpets.com|@dbzmail.com|@dcemail.com|@didamail.com|@doneasy.com|@doramail.com|@emailaccount.com|@fastmail.ca|@flashmail.com|@graffiti.net|@hushmail.com|@letterbox.org|@hush.com|@hush.ai|@icqmail.com|@incamail.com|@indiatimes.com|@kittymail.com|@linuxmail.org|@lycos.com|@mail2|@mailblocks.com|@123mail.org|@150mail.com|@150ml.com|@16mail.com|@2-mail.com|@4email.net|@50mail.com|@airpost.net|@allmail.net|@bestmail.us|@cluemail.com|@elitemail.org|@emailgroups.net|@emailplus.org|@emailuser.net|@eml.cc|@fastem.com|@fast-email.com|@fastemail.us|@fastemailer.com|@fastest.cc|@fastimap.com|@fastmail.cn|@fastmail.com.au|@fastmail.fm|@fastmail.us|@fmail.co.uk|@fast-mail.org|@fastmailbox.net|@fastmessaging.com|@fea.st|@f-m.fm|@fmailbox.com|@fmgirl.com|@fmguy.com|@ftml.net|@hailmail.net|@imap.cc|@imap-mail.com|@imapmail.org|@internet-e-mail.com|@internetemails.net|@internet-mail.org|@internetmailing.net|@jetemail.net|@justemail.net|@letterboxes.org|@mailandftp.com|@mailas.com|@mailbolt.com|@mailc.net|@mailcan.com|@mail-central.com|@mailforce.net|@mailftp.com|@mailhaven.com|@mailingaddress.org|@mailite.com|@mailmight.com|@mailnew.com|@mail-Page.com|@mailsent.net|@mailup.net|@mailworks.org|@ml1.net|@mm.st|@myfastmail.com|@mymacmail.com|@nospammail.net|@ownmail.net|@petml.com|@postinbox.com|@postpro.net|@proinbox.com|@promessage.com|@realemail.net|@reallyfast.biz|@reallyfast.info|@rushpost.com|@sent.As|@sent.at|@sent.com|@speedpost.net|@speedymail.org|@ssl-mail.com|@swift-mail.com|@the-fastest.net|@theinternetemail.com|@the-quickest.com|@veryfast.biz|@veryspeedy.net|@warpmail.net|@xsmail.com|@yepmail.net|@your-mail.com|@mailpanda.com|138mail.com|asiamail.com|koreanmail.com|mailasia.com|mantramail.com|@marchmail.com|@antisocial.com|@as-if.com|@backstreet-boys.com|@beenhad.com|@canwetalk.com|@corporatedirtbag.com|@crazedanddazed.com|@crazysexycool.com|@dangerous-minds.com|@deal-maker.com|@forpresident.com|@iamit.com|@iamwaiting.com|@ididitmyway.com|@ihavepms.com|@ijustdontcare.com|@imneverwrong.com|@imstressed.com|@itookmyprozak.com|@ivebeenframed.com|@married-not.com|@most-wanted.com|@mystupidjob.com|@mystupidschool.com|@notme.com|@teenagedirtbag.com|@trust-me.com|@wouldilie.com|@yeayea.com|@hehe.com|@iamwasted.com|@ilovechocolate.com|@keg-party.com|@mr-potatoehead.com|@o-tay.com|@quackquack.com|@rednecks.com|@smileyface.com|@youareadork.com|@your-house.com|@1internetdrive.com|@1netdrive.com|@1webave.com|@1webhighway.com|@cyberbabies.com|@internetdrive.com|@mydotcomaddress.com|@mynetaddress.com|@myownemail.com|@netexecutive.com|@netexpressway.com|@netlane.com|@netlimit.com|@netspeedway.com|@pcpostal.com|@starmail.com|@supernetpower.com|@webjetters.com|@1coolplace.com|@1funplace.com|@1under.com|@anywhereusa.com|@cornerpub.com|@dontmesswithtexas.com|@earthdome.com|@end-war.com|@givepieceachance.com|@hollywoodkids.com|@isellcars.com|@jazzandjava.com|@localbar.com|@moonman.com|@moonshinehollow.com|@starplace.com|@the-stock-market.com|@thevortex.com|@white-star.com|@for-president.com|@millionaireintraining.com|@mostlysunny.com|@partlycloudy.com|@phayze.com|@positive-thinking.com|@rodrun.com|@rubyridge.com|@somethingorother.com|@spyring.com|@stopdropandroll.com|@sunrise-sunset.com|@the-any-key.com|@the-big-apple.com|@the-eagles.com|@the-lair.com|@the-pentagon.com|@the-police.com|@thelanddownunder.com|@tropicalstorm.com|@wolf-web.com|@yuppieintraining.com|@zahadum.com|@coffin-rock.com|@death-star.com|@earthalliance.com|@galaxy5.com|@marsattack.com|@over-the-rainbow.com|@psicorps.com|@pulp-fiction.com|@scifianime.com|@scififan.com|@vorolonempire.com|@1musicrow.com|@1nsyncfan.com|@ace-of-base.com|@kornfreak.com|@nirvanafan.com|@smashing-pumpkins.com|@baldandsexy.com|@buffbody.com|@cuteandcudly.com|@cyberloveplace.com|@finebody.com|@freeandsingle.com|@girlofyourdreams.com|@guyofyourdreams.com|@heartthrob.com|@iamyours.com|@imtoosexy.com|@lookingforme.com|@lover-boy.com|@lovergirl.com|@onecooldude.com|@tellmeimcute.com|@toosexyforyou.com|@wetwetwet.com|@bullsfan.com|@bullsgame.com|@hang-ten.com|@jazzgame.com|@ohio-state.com|@pakersfan.com|@pool-sharks.com|@sportsaddict.com|@sunsgame.com|@the18th.com|@thegolfcourse.com|@theraces.com|@theteebox.com|@tigerdrive.com|@winningteam.com|@all-mychildren.com|@another-world.com|@babylon5fan.com|@bay-watch.com|@friendsfan.com|@general-hospital.com|@sailormoonfan.com|@speed-race.com|@xfilesfan.com|@yada-yada.com|@mypersonalemail.com|@myway.com|@netster.com|@online.ie|@operamail.com|@orcon.net.nz|@outgun.com|@postmaster.co.uk|@prontomail.com|@recyclermail.com|@rediffmail.com|@romymichele.com|@sandiego.com|@s-mail.com|@shadango.com|@safe-mail.net|@stalag13.com|@surfy.net|@themail.com|@tmicha.net|@ureach.com|@uymail.com|@vfemail.net|@virtual-mail.com|@vorras.net|@weekonline.com|@x-mail.net|@yyhmail.com|@cwazy.co.uk|@redwhitearmy.com|@caths.co.uk|@marketweighton.com|@freemail.org.mk|@gawab.com|@alex4all.com|@alexandria.cc|@hotpop.com|@punkass.com|@sexmagnet.com|@bonbon.net|@toughguy.net|@phreaker.net|@gamebox.net|@mailshack.com|@nerdshack.com|@postmark.net|@safe-mail.net|@softhome.net|@tmicha.net|@vfemail.net|@ezrs.com|@yebox.com|@yapost.com|@mail15.com|@aggies.org|@arrl.net|@bonnag.com|@dragoncon.net|@softhome.net|@zworg.com|@mailpuppy.com|@mailandnews.com|@newmail.net|@uymail.com|@youpy.com|@forfree.at|@pemail.net|@anything.2ndmail.com|@offeremail.com|@freeindex.com|@birdmail.com|@mailpanda.com|@kube93mail.com|@startrekmail.com|@garbagemail.com|@dog.com|@msgbox.com|@schoolsucks.com|@vote4gop.org|@letsgomets.net|@chickmail.com|@happypuppy.com|@joinme.com|@cnn.com|@garfield.com|@rotfl.com|@chickmail.com|@netscape.net|@popmail.com|@unbounded.com|@zdnetmail.com|@letterbox.com|@gnwmail.com|@lycosemail.com|@goplay.com|@mailexcite.com|@alloymail.com|@cynetcity.com|@rocketmail.com|@eg3.net|@mail.spaceports.com|@thedoghousemail.com|@byteme.com|@gurlmail.com|@iforward.com|@populus.net|@flashemail.com|@mailcity.com|@linktrader.com|@freestamp.com|@888.nu|@coldmail.com|@gmx.de|@zWallet.com|@MyFamily.com|@MailCity.com|@Lovemail.com|@iWon.com|@iVillage.com|@HotVoice.com|@BizLand.com|@About.com|@Mailblocks.com|@gmail.com|@cnt.com|@brocade.com/;
return regex.test(src);
}	

