/**************************EMAIL CHECKING***************************/
 
 
 function checkmail(fldname,dothis)
  {  

	//for all email fields in any forms - BOTH FOR ADMIN/USERS
	
	var msg = "";  	
	if(dothis == "string")
	email = fldname
	else
	email = fldname.value;

	var len = email.length;              

	if(len<5)
		{
			msg += "Invalid Email - id!\n";
		}
	else
		{
          
	var index1 = email.indexOf('@');
	var subind = email.substring(0,index1);
	var indlen = subind.length;
	var index2 = email.indexOf('.');
	var subind1=email.substring(indlen+1,index2);
	var indlen1 = subind1.length;
	var index3 = email.indexOf(' ');
	var subind3=email.substring(index2+1,len)
	var indlen2 = subind3.length;
	if((index1!= -1)&&(index2!= -1)&&(index3==-1))
	{	
		if((indlen!=0)&&(indlen1!=0)&&(indlen2!=0))
		{
//   			alert("valid Email -id");		  	 	
		} 
        else
		{
			msg += "Invalid Email - id!\n";
		}
	}
	else
	{
   		msg += "Invalid Email - id!\n";
	}		
	} // end of else if len<5

	if(dothis == "string")
	{
		return msg;
	}

	if(msg.length > 0)
	{
			fldname.value="";
			
			alert(msg);
	}

  }	


/***************************************************************************/

function cap_signup_step1()
{

	var msg="";
	
	email=document.signupfrm.email.value;
	pass=document.signupfrm.password.value;
	cpass=document.signupfrm.cpassword.value;

	if(email.length==0)
		msg+="Please enter your Email!\n";
	if(pass.length==0)
		msg+="Please enter your Password!\n";
	if(cpass.length==0)
		msg+="Please confirm your Password!\n";

	if(pass != cpass)
		msg+="Passwords does not match!\n";

	if(msg.length > 0)
		alert(msg)
	else
		document.signupfrm.submit();	

}




/*****************************************************************************/

var option_value=0;
function chk_month(obj)
{
	option_value=obj.value;
//	alert(option_value)
}

var option_cc=0;
function chk_card(obj)
{
	option_cc=obj.value;
//	alert(option_cc);
}

function cap_signup_step2(obj)
{
	var msg="";

/***for entrepreneur, the following validation is not required****/
	if(obj!="ent")
	{
	if(option_value==0)
		msg+="Please choose a Payment Option!\n";
 	}
/***for entrepreneur, the above validation is not required****/
	/*if(option_cc==0)
		msg+="Plese choose a Credit Card type!\n";
	*/	
		
//	cc_holdername=document.signupfrm_step2.cc_holdername.value;
	cc_number=document.signupfrm_step2.cc_number.value;		
	cc_pin=document.signupfrm_step2.cc_verifinum.value;		
	cc_type=document.signupfrm_step2.cc_type.value;
	cc_exp_year=document.signupfrm_step2.cc_exp_year.value;			
	cc_exp_month=document.signupfrm_step2.cc_exp_month.value
	
	bill_contactname=document.signupfrm_step2.bill_contactname.value;		
//	bill_companyname=document.signupfrm_step2.bill_companyname.value;		
//	bill_email=document.signupfrm_step2.bill_email.value;		
	bill_companyaddress=document.signupfrm_step2.bill_companyaddress.value;
	bill_city=document.signupfrm_step2.bill_city.value;
	bill_zip=document.signupfrm_step2.bill_zip.value;
	bill_lastname=document.signupfrm_step2.bill_lastname.value;
	if(bill_contactname.length==0)
		msg+="Please enter your First Name!\n";
	if(bill_lastname.length==0)
		msg+="Please enter your Last Name!\n";
/*	
	if(cc_holdername.length==0)
		msg+="Please enter your name on the Card!\n";
*/
	if(cc_type=="")	
		msg+="Please select your Credit Card Type!\n";		
	if(!(cc_number.length>12))	
		msg+="Please enter you correct Card Number!\n";
		
	if(cc_pin.length==0)
		msg+="Please enter your Card Verification #!\n";
		
	
	if(cc_exp_month=="")
		msg+="Please select Month of Expiry!\n";
	if((cc_exp_year==-1)||(cc_exp_year==""))
		msg+="Please select Year of Expiry!\n";	
	
/*	
	if(bill_companyname.length==0)
		msg+="Please enter your Company Name!\n"
		
	if(bill_email.length==0)	
		msg+="Please enter your Email!\n";
*/		
	if(bill_companyaddress.length==0)
		msg+="Please enter your Address!\n";
	if(bill_city.length==0)
		msg+="Please enter your City!\n";

	if(bill_zip.length==0)
		msg+="Please enter your Zip code!\n";
	if(document.signupfrm_step2.term.checked!=true)
		msg+="Please agree to the terms and conditions to continue.\n";
						
	if(msg.length > 0)
		alert(msg);	
	else
		document.signupfrm_step2.submit();	
}	


/***************************************************************************/
function login()
{
	var msg="";

  if(document.loginfrm.username.value.length==0)
	msg+="Please enter your Email Address!\n";
  if(document.loginfrm.password.value.length==0)
	msg+="Please enter your Password!\n";

	if(msg.length>0)
		alert(msg)
	else			
		document.loginfrm.submit();

}

/***************************************************************************/
function cap_profile_step1(obj)
{
	var msg="";

	document.profilefrm.action.value=obj;
/*
	if(obj=="exit")
		document.profilefrm.action.value="exit";
	else
		document.profilefrm.action.value="continue";
*/

	companyname=document.profilefrm.companyname.value;

	firstname=document.profilefrm.firstname.value;
	middlename=document.profilefrm.middlename.value;
	lastname=document.profilefrm.lastname.value;

	phone1=document.profilefrm.phone1.value;
	phone2=document.profilefrm.phone2.value;
	phone3=document.profilefrm.phone3.value;
	
	email=document.profilefrm.email.value;	
	cemail=document.profilefrm.cemail.value;	
	
	address1=document.profilefrm.address1.value;
	
	city=document.profilefrm.city.value;
	state=document.profilefrm.state.value;
	zipcode=document.profilefrm.zipcode.value;
	country=document.profilefrm.country.value;				
	
	if(companyname.length==0)
		msg+="Please enter your Company name!\n";
	
	if(firstname.length==0)
		msg+="Please enter your First name!\n";		
/*
	if(middlename.length==0)
		msg+="Please enter your Middle name!\n";		
*/
/*
	if(lastname.length==0)
		msg+="Please enter your Last name!\n";
*/	
		
	if(phone1.length==0 || phone2.length==0 || phone3.length==0)
		msg+="Please enter your Phone number!\n";
		
	if(email.length==0)
		msg+="Please enter your Email address!\n";		
				
	if(cemail.length==0)
		msg+="Please confirm your Email address!\n";
		
	if(email != cemail)
		msg+="Emails does not match!\n";			
	
	if(address1.length==0)
		msg+="Please enter your Address!\n";		

	if(city.length==0)
		msg+="Please enter your City!\n";		
/*		
	if(state==-1)
		msg+="Please enter your State!\n";		

	if(zipcode.length==0)
		msg+="Please enter your Zip code!\n";		
*/		
	if(country==-1)
		msg+="Please enter your Country!\n";		
		
		
	if(msg.length > 0)
		alert(msg)
	else		
		document.profilefrm.submit();	
}

/***************************************************************************/
function cap_profile_step2(obj)
{
	var msg="";
	document.profilefrm.action.value=obj;
/*
	if(obj=="exit")
		document.profilefrm.action.value="exit";
	else
		document.profilefrm.action.value="continue";
*/
for(i=0;i<document.profilefrm.elements.length;i++)
{
	if(document.profilefrm.elements[i].name=="industry[]")
		{
			if(document.profilefrm.elements[i].value==-1)
				msg+="Choose Focus Industry!\n";

		}			
}

	if(msg.length > 0)
		alert(msg)
	else
		document.profilefrm.submit();

}

/***********************************************************************************/
function cap_profile_step3(obj)
{
	var msg="";
	document.profilefrm.action.value=obj;
/*
	if(obj=="exit")
		document.profilefrm.action.value="exit";
	else
		document.profilefrm.action.value="continue";
*/		
for(i=0;i<document.profilefrm.elements.length;i++)
{

	if(document.profilefrm.elements[i].name=="financialstage[]")
		{
			if(document.profilefrm.elements[i].value==-1)
				msg+="Choose a Financial Stage!\n";

		}

}

	if(msg.length > 0)
		alert(msg)
	else
		document.profilefrm.submit();				

}
/***********************************************************************************/

/***********************************************************************************/
function cap_profile_step4(obj)
{
	var msg="";
	document.profilefrm.action.value=obj;
/*
	if(obj=="exit")
		document.profilefrm.action.value="exit";
	else
		document.profilefrm.action.value="continue";
*/		
		
/*		
	if(document.profilefrm.state.value==-1)
		msg+="Please choose a State!\n";
	if(document.profilefrm.country.value==-1)
		msg+="Please choose a Country!\n";
*/


for(i=0;i<document.profilefrm.elements.length;i++)
{

	if(document.profilefrm.elements[i].name=="state[]")
		{
			if(document.profilefrm.elements[i].value==-1)
				msg+="Choose a State!\n";

		}

}

for(i=0;i<document.profilefrm.elements.length;i++)
{

	if(document.profilefrm.elements[i].name=="country[]")
		{
			if(document.profilefrm.elements[i].value==-1)
				msg+="Choose a Country!\n";

		}

}


	if(msg.length > 0)
		alert(msg)
	else
		document.profilefrm.submit();				

}
/***********************************************************************************/


//	TO SELECT FROM SELECTION BOX
function selectmenu(obj,val)
{

  var len=obj.options.length

  for(var i=0;i<len;i++)
  {
    if(obj.options[i].value==val)
     {
       obj.selectedIndex=i;
     }
  } 
}

/***************************************************************************/

function numcheck(obj)
  {
    var msg = ""
    if(isNaN(obj.value)|| (obj.value.indexOf(' ')!=-1))
	{
	  msg = "Enter Numerical Values \n"
          obj.value = ""          
    }

	
    if(msg.length > 0)
		alert(msg)

  }
/*****************************************************************************/

/***************************************************************************/
function login_admin()
{
	var msg="";

  if(document.loginfrm.username.value.length==0)
	msg+="Please enter your Username!\n";
  if(document.loginfrm.password.value.length==0)
	msg+="Please enter your Password!\n";

	if(msg.length>0)
		alert(msg)
	else			
		document.loginfrm.submit();

}

/***************************************************************************/
function alert_deletecap(obj)
{
	var c=confirm("Are you sure that you want to delete this Capitalist?");
//	alert(c)
	
	if(c)
		{
			window.location.href="delete_cap.php?id="+obj
		}
}

function alert_deleteibk(obj)
{
	var c=confirm("Are you sure that you want to delete this I-Bank?");
//	alert(c)
	
	if(c)
		{
			window.location.href="delete_ibk.php?id="+obj
		}
}

/****************************************************************************************/
function edit_cap()
{

	var msg="";
	
	email=document.signupfrm.email.value;
	pass=document.signupfrm.password.value;

/*

	bill_contactname=document.signupfrm.bill_contactname.value;		
	bill_companyname=document.signupfrm.bill_companyname.value;		
	bill_email=document.signupfrm.bill_email.value;		
	bill_companyaddress=document.signupfrm.bill_companyaddress.value;
*/
	
	
	if(email.length==0)
		msg+="Please enter your Email!\n";
	if(pass.length==0)
		msg+="Please enter your Password!\n";
/*
	if(bill_contactname.length==0)
		msg+="Please enter your Contact Name!\n";
	
	if(bill_companyname.length==0)
		msg+="Please enter your Company Name!\n"
		
	if(bill_email.length==0)	
		msg+="Please enter your Email!\n";
		
	if(bill_companyaddress.length==0)
		msg+="Please enter your Company Address!\n";


*/
	if(msg.length > 0)
		alert(msg)
	else
		document.signupfrm.submit();	

}

/***************************************************************************/
function addcap()
{
	var msg="";

  if(document.signupfrm.email.value.length==0)
	msg+="Please enter Email!\n";
  if(document.signupfrm.password.value.length==0)
	msg+="Please enter Password!\n";

	if(msg.length>0)
		alert(msg)
	else			
		document.signupfrm.submit();

}

/****************************************************************************************/
/****************************ENTREPRENEUR AREA*********************************/
/*
var memtype=0;
function chkradio_memtype(obj)
{
	memtype=obj.value;
//	alert(memtype)
}
*/
var access=-1;
function chkradio_premium(obj)
{
	access=obj.value;
//	alert(access)
}




function ent_signup_main()
{

	var msg="";
	
	email=document.signupfrm.email.value;
	pass=document.signupfrm.password.value;
	cpass=document.signupfrm.cpassword.value;

//for membership options
/*
	if(memtype==0)
		msg+="Choose a membership option!\n";
		
	if(memtype=="P")
	{
		if(access==0)
			msg+="Choose the type of subscription!\n";
	}
	*/
	if(access==-1)
		msg+="Choose a membership option!\n";
	
	
	if(email.length==0)
		msg+="Please enter your Email!\n";
	if(pass.length==0)
		msg+="Please enter your Password!\n";
	if(cpass.length==0)
		msg+="Please confirm your Password!\n";

	if(pass != cpass)
		msg+="Passwords does not match!\n";

	if(msg.length > 0)
		alert(msg)
	else
		document.signupfrm.submit();	

}




/*****************************************************************************/
function sendemail()
{
	if(document.emailfrm.message.value.length==0)
		alert("Please enter your message!");
	else
		document.emailfrm.submit();
}
/****************************************************************************************/

function edit_email()
{
	var msg="";
	
	email_old=document.editfrm.email_old.value;
	email_new=document.editfrm.email_new.value;
	cemail_new=document.editfrm.cemail_new.value;
	
	if(email_old.length==0)
		msg+="Please enter your current Email address!\n";	

	if(email_new.length==0)
		msg+="Please enter your new Email address!\n";	
		
	if(cemail_new.length==0)
		msg+="Please confirm your new Email address!\n";
		
	if(email_new != cemail_new)
		msg+="Emails does not match!\n";		
		
	if(msg.length > 0)
		alert(msg)
	else
		document.editfrm.submit();				
		
}

/****************************************************************************************/

function edit_pass()
{
	var msg="";
	
	pass_old=document.editfrm.pass_old.value;
	pass=document.editfrm.pass.value;
	cpass=document.editfrm.cpass.value;
	
	if(pass_old.length==0)
		msg+="Please enter your current Password!\n";	

	if(pass.length==0)
		msg+="Please enter your new Password!\n";	
		
	if(cpass.length==0)
		msg+="Please confirm your new Password!\n";
		
	if(pass != cpass)
		msg+="Passwords does not match!\n";		
		
	if(msg.length > 0)
		alert(msg)
	else
		document.editfrm.submit();				
		
}



/****************************************************************************************/
/***************************************************************************/
function ent_profile_step2(obj)
{
	var msg="";
	document.profilefrm.action.value=obj;
/*
	if(obj=="exit")
		document.profilefrm.action.value="exit";
	else
		document.profilefrm.action.value="continue";
*/
//010905 - user should not be allowed to select more than two industries - Start


var industry_ctr = 0;

if(document.profilefrm.validate_industry.value == 1)
{ //need to validate only in companies and investors section...

for(i=0;i<document.profilefrm.elements.length;i++)
{
	if(document.profilefrm.elements[i].name == "industry[]")
		{
			/* 010905 - user should not be allowed to select more than two industries
			if(document.profilefrm.elements[i].value==-1)
				msg+="Choose Industry!\n";
			*/
			
			if(document.profilefrm.elements[i].checked == true)
			industry_ctr++;
			
		}			
}

}
if(industry_ctr > 2)
	msg += "Can choose only two industries\n";

/*
	if(document.profilefrm.technologydetails.value.length==0)
		msg+="Please enter Technology Details!\n";
*/
	var b= new Array();

	b=document.profilefrm.technologydetails.value.split (' ');

	if(b.length < 20 && 1==2) //190704 - not reqd..
		msg+="Enter atleast 20 words in Company Briefings\n";
	
	if(b.length > 100)
		msg+="Company Briefings should be limited to 100 words\n";



	if(msg.length > 0)
		alert(msg)
	else
		document.profilefrm.submit();

}

/***********************************************************************************/
function ent_profile_step3(obj)
{
	var msg="";
	document.profilefrm.action.value=obj;
/*
	if(obj=="exit")
		document.profilefrm.action.value="exit";
	else
		document.profilefrm.action.value="continue";
*/

/*
	if(document.profilefrm.marketinfo.value.length==0)
		msg+="Please enter Market Information!\n";
*/

	var b= new Array();

	b=document.profilefrm.marketinfo.value.split (' ');

	if(b.length < 20)
		msg+="Enter atleast 20 words in Market Information\n";
	
	if(b.length > 100)
		msg+="Market Information should be limited to 100 words\n";


	if(msg.length > 0)
		alert(msg)
	else
		document.profilefrm.submit();

}

/***********************************************************************************/
/***********************************************************************************/
function ent_profile_step4(obj)
{

	var msg="";
	document.profilefrm.action.value=obj;
/*
	if(obj=="exit")
		document.profilefrm.action.value="exit";
	else if(obj=="continue")		
		document.profilefrm.action.value="continue";
	else if(obj=="back")
		document.profilefrm.action.value="comeback";			
*/
	if(document.profilefrm.name.value.length==0)
		msg+="Please enter Name!\n";

	if(document.profilefrm.title.value.length==0)
		msg+="Please enter Title!\n";

	if(msg.length > 0)
		alert(msg)
	else
		document.profilefrm.submit();

}

/***********************************************************************************/
function ent_profile_step5(obj)
{

	var msg="";
	document.profilefrm.action.value=obj;
/*
	if(obj=="exit")
		document.profilefrm.action.value="exit";
	else if(obj=="continue")		
		document.profilefrm.action.value="continue";
	else if(obj=="back")
		document.profilefrm.action.value="comeback";			
*/
/*
	if(document.profilefrm.name.value.length==0)
		msg+="Please enter Name!\n";
*/
	if(document.profilefrm.experience.value.length==0)
		msg+="Please enter experience!\n";

	if(msg.length > 0)
		alert(msg)
	else
		document.profilefrm.submit();

}

/***********************************************************************************/
/***********************************************************************************/
function ent_profile_step6(obj)
{

	var msg="";
	document.profilefrm.action.value=obj;
/*
	if(obj=="exit")
		document.profilefrm.action.value="exit";
	else if(obj=="continue")		
		document.profilefrm.action.value="continue";
	else if(obj=="back")
		document.profilefrm.action.value="comeback";			
*/

	if(obj=="back")
	{	
	if(document.profilefrm.name.value.length==0)
		msg+="Please enter Name!\n";

/*
	
	if(document.profilefrm.experience.value.length==0)
		msg+="Please enter experience!\n";
*/
	if(msg.length > 0)
		alert(msg)
	else
		document.profilefrm.submit();
	}
	else
	{
		document.profilefrm.submit();	
		//window.location.href="editprofile_step7.php";
	}	
		
			


}

/***************************************************************************/
function alert_deleteent(obj)
{
	var c=confirm("Are you sure that you want to delete this Entrepreneur?");

	
	if(c)
		{
			window.location.href="delete_ent.php?id="+obj
		}
}

/***************************************************************************/
function alert_deletenews(obj)
{
	var c=confirm("Are you sure that you want to delete this Subscriber?");

	
	if(c)
		{
			window.location.href="delete_news.php?id="+obj
		}
}


/****************************************************************************************/
function billing()
{
	var msg="";
	if(document.billfrm.bill_companyaddress.value.length==0)
		msg+="Please enter billing address!\n";
	if(document.billfrm.bill_zip.value.length==0)
		msg+="Please enter Zip code!\n";
		
	if(msg.length > 0)
		alert(msg)	
	else
		document.billfrm.submit();	
				
}
/***********************************************************************************/
function popupwindow(obj)
{
	window.open(obj, '', "scrollbar=no, menu=no, status=no, resizable=no, width=350, height=475,left=10, top=10" );
}
/***************************************************************************/
function step_uploadfile(obj)
{
	var msg="";
	document.profilefrm.action.value=obj;

	document.profilefrm.submit();

}
/***********************************************************************************/
function contact_step2()
{
	var msg="";
	if(document.contactfrm.companyname.value.length==0)
		msg+="Please enter your Company name!\n";

	if(document.contactfrm.contactname.value.length==0)
		msg+="Please enter your Contact name!\n";

	if(document.contactfrm.contactemail.value.length==0)
		msg+="Please enter your Contact email!\n";

	if(msg.length > 0)
		alert(msg)
	else
		document.contactfrm.submit();
}
/***********************************************************************************/
function contact_inv_step2()
{
	var msg="";
	if(document.profilefrm.companyname.value.length==0)
		msg+="Please enter your Company name!\n";

	if(document.profilefrm.contactname.value.length==0)
		msg+="Please enter your Contact name!\n";

	if(document.profilefrm.contactemail.value.length==0)
		msg+="Please enter your Contact email!\n";

	if(msg.length > 0)
		alert(msg)
	else
		document.profilefrm.submit();

}
/***********************************************************************************/
var agreed="";
function radio_agree(obj)
{
	agreed=obj.value
}

function contact_inv_step4()
{
	var msg="";
	if(agreed!="yes")
		alert("You must agree to the terms");
	else
			document.previewfrm.submit();			
}

/***********************************************************************************/

/***************************************************************************/
function login_h()
{
	var msg="";

	
  if(document.loginfrm_h.username.value.length==0)
	msg+="Please enter your Username!\n";
  if(document.loginfrm_h.password.value.length==0)
	msg+="Please enter your Password!\n";

	if(msg.length>0)
		alert(msg)
	else			
		document.loginfrm_h.submit();

}

/***************************************************************************/
function email_password()
{
	var msg="";
	
	if(document.emailfrm.from.value.length==0)
		msg+="Please enter from address\n";
	if(document.emailfrm.subject.value.length==0)
		msg+="Please enter subject\n";

	if(msg.length > 0)
		alert(msg)
	else
		document.emailfrm.submit();
}
/***********************************************************************************/
function sendmail_step2()
{
	var msg="";

	if(document.emailfrm.from.value.length==0)
		msg+="Please enter from address\n";
	if(document.emailfrm.subject.value.length==0)
		msg+="Please enter subject\n";
	if(document.emailfrm.message.value.length==0)
		msg+="Please enter message\n";

	if(msg.length > 0)
		alert(msg)
	else
		document.emailfrm.submit();


}
/***********************************************************************************/
function chkagree()
{
	if(document.signupfrm_step2.agree.checked)
		document.signupfrm_step2.submit();
	else		
		alert("Please agree to the terms and conditions to continue.")
}

/***********************************************************************************/
function openwin_agreement()
{
	var obj="../agreement.html";

	window.open(obj, '', "scrollbars=yes, menu=no, status=no, resizable, width=350, height=250");
}
/***************************************************************************/
function replyemail()
{
	var msg="";

	var b= new Array();

	message=document.replyfrm.message.value.length;

	if(message==0)
		msg+="Please enter your reply\n";

	b=document.replyfrm.message.value.split (' ');

	if(b.length > 200)
		msg+="Reply should be limited to 200 words\n";

	if(msg.length > 0)
		alert(msg)
	else
		document.replyfrm.submit();

}
/***********************************************************************************/

/***********************************************************************************/

function inv_profile_step4(obj)
{

	var msg="";
	document.profilefrm.action.value=obj;
/*
	if(obj=="exit")
		document.profilefrm.action.value="exit";
	else if(obj=="continue")		
		document.profilefrm.action.value="continue";
	else if(obj=="back")
		document.profilefrm.action.value="comeback";			
*/
	if(document.profilefrm.name.value.length==0)
		msg+="Please enter Name!\n";

	if(document.profilefrm.title.value.length==0)
		msg+="Please enter Title!\n";

	if(msg.length > 0)
		alert(msg)
	else
		document.profilefrm.submit();

}


function check_all(frm,sel,val)

{



	for(i=0;i<eval("document." + frm + ".elements.length");i++)

	{

	nam = eval("document." + frm + ".elements[" + i + "].name");



		if(nam.substring(0,3)==val)

		{

		eval("document." + frm + ".elements[" + i + "].checked = " + sel.checked);


		} //end if==val

	} //end for

} //end function


function redirect_page(obj) //for dropdowns..
{
	
	filepath=obj.value;
	if(filepath.length > 0)
		eval("window.location.href='" + filepath + "'");
}


function contact_sercvice()
{
var msg="";
	if(document.contactfrm.emailfr.value.length == 0)
		msg+="Please enter Email!\n";
	if(document.contactfrm.subject.value.length == 0)
		msg+="Please enter Subject!\n";
	if(document.contactfrm.comments.value.length == 0)
		msg+="Please enter your comments or questions!\n";
	if(msg.length > 0)
		alert(msg)
	else
		document.contactfrm.submit();	
}	

function newsmail()
{
var msg="";
	if(document.news.email.value.length <= 0)
	  msg+="Please enter your email";
	else
	  msg += new_checkmail(document.news.email,"string","");
	   
	if(msg.length > 0)
	{
		alert(msg);
		return false;
	}
	else
	  return true;
}	  

function popupwindow_tips(obj)
{
	window.open(obj, '', "scrollbars=yes, menu=no, status=no, resizable=no, width=350, height=350, left=10, top=10");
}

function popupwindow_overview(obj) //151204
{
	window.open(obj, '', "scrollbars=yes, menu=no, status=no, resizable=no, width=580, height=335, left=10, top=10");
}

function express_details(val)
{
var msg="";
if(val > 0)
{
	if(document.details.subject.value.length<=0)
	  msg+="Please enter a subject\n";
	document.details.action.value='preview';
		  
}	
else
{
	if(document.details.companyname.value.length<=0)
	  msg+="Please enter your company name\n";
}

	if(msg.length > 0)
		alert(msg);
	else
	  document.details.submit();
}


function popupwindow_features(obj,fea) //151204
{
	var str="";
	str="scrollbars=yes, menu=no, status=no, resizable=yes,left=10, top=10,"+fea;
	window.open(obj, '', str);
}


//for rollover images - start - 110205

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];}
}

//for rollover images - start - 110205
//120905 - forwar to a friend... - Start

function forward_submit()
{

var msg = "", dc = document.forward_frm;
var email_arr,t_msg = "";
email_arr = new Array();

if(dc.sender_email.value.length <= 0)
	msg += "Please enter your email address!\n";

if(dc.to_emailids.value.length <= 0)
	msg += "Please enter email address to whom you want to send email!\n";
if(dc.personal_message.value.length <= 0)
	msg += "Please enter message!\n";



if(msg.length > 0)
{
	alert(msg);
	return false;
}
else
{
	return true;
}

} //end function forward_submit()

//120905 - forwar to a friend... - End

 function new_checkmail(fldname,dothis,alert_lbl)
  {  

	//for all email fields in any forms - BOTH FOR ADMIN/USERS
	
	var msg = "";  	
	email = fldname.value;

	var len = email.length;              

	if(len<5)
		{
			msg += "Please enter your email";
		}
	else
		{
          
	var index1 = email.indexOf('@');
	var subind = email.substring(0,index1);
	var indlen = subind.length;
	var index2 = email.indexOf('.');
	var subind1=email.substring(indlen+1,index2);
	var indlen1 = subind1.length;
	var index3 = email.indexOf(' ');
	var subind3=email.substring(index2+1,len)
	var indlen2 = subind3.length;
	if((index1!= -1)&&(index2!= -1)&&(index3==-1))
	{	
		if((indlen!=0)&&(indlen1!=0)&&(indlen2!=0))
		{
//   			alert("valid Email -id");		  	 	
		} 
        else
		{
			msg += "Please enter your email";
		}
	}
	else
	{
   		msg += "Please enter your email";
	}		
	} // end of else if len<5
	
	if(msg.length > 0)
	{
		
		if(alert_lbl.length > 0)
		msg += " for " + alert_lbl;
		
		msg += "!\n";
	}
		
	if(dothis == "string")
	{
		return msg;
	}

	if(msg.length > 0)
	{
			fldname.value="";
			
			alert(msg);
	}

  }	

function unsubscribe_newsmail()
{
var msg="";
	if(document.news.nl_email.value.length <= 0)
	  msg+="Please enter your email";
	else
	  msg += new_checkmail(document.news.nl_email,"string","");
	   
	if(msg.length > 0)
	{
		alert(msg);
		return false;
	}
	else
	  return true;
}	  














function validate_membership_paypal()
{

//if(option_value==0)
if(document.signupfrm_step2_paypal.month[0].checked == false && document.signupfrm_step2_paypal.month[1].checked == false && document.signupfrm_step2_paypal.month[2].checked == false) //210705
{
	alert("Please choose membership option!\n");
	return false;
}
else
{
	return true;
}
}

function validate_membership_old()
{

//if(option_value==0)
if(document.signupfrm_step2.month[0].checked == false && document.signupfrm_step2.month[1].checked == false && document.signupfrm_step2.month[2].checked == false) //210705
{
	alert("Please choose membership option!\n");
	return false;
}
else
{
	return true;
}

}



function cap_signup_step2_new(obj)
{
	var msg="";

	option_value=1;
	
/***for entrepreneur, the following validation is not required****/
	if(obj!="ent")
	{
	if(option_value==0)
		msg+="Please choose a Payment Option!\n";
 	}
/***for entrepreneur, the above validation is not required****/
	/*if(option_cc==0)
		msg+="Plese choose a Credit Card type!\n";
	*/	
		
//	cc_holdername=document.signupfrm_step2.cc_holdername.value;
	cc_number=document.signupfrm_step2.cc_number.value;		
	cc_pin=document.signupfrm_step2.cc_verifinum.value;		
	cc_type=document.signupfrm_step2.cc_type.value;
	cc_exp_year=document.signupfrm_step2.cc_exp_year.value;			
	cc_exp_month=document.signupfrm_step2.cc_exp_month.value
	
	bill_contactname=document.signupfrm_step2.bill_contactname.value;		
//	bill_companyname=document.signupfrm_step2.bill_companyname.value;		
//	bill_email=document.signupfrm_step2.bill_email.value;		
	bill_companyaddress=document.signupfrm_step2.bill_companyaddress.value;
	bill_city=document.signupfrm_step2.bill_city.value;
	bill_zip=document.signupfrm_step2.bill_zip.value;
	bill_lastname=document.signupfrm_step2.bill_lastname.value;
	if(bill_contactname.length==0)
		msg+="Please enter your First Name!\n";
	if(bill_lastname.length==0)
		msg+="Please enter your Last Name!\n";
/*	
	if(cc_holdername.length==0)
		msg+="Please enter your name on the Card!\n";
*/
	if(cc_type=="")	
		msg+="Please select your Credit Card Type!\n";		
	if(!(cc_number.length>12))	
		msg+="Please enter you correct Card Number!\n";
		
	if(cc_pin.length==0)
		msg+="Please enter your Card Verification #!\n";
		
	
	if(cc_exp_month=="")
		msg+="Please select Month of Expiry!\n";
	if((cc_exp_year==-1)||(cc_exp_year==""))
		msg+="Please select Year of Expiry!\n";	
	
/*	
	if(bill_companyname.length==0)
		msg+="Please enter your Company Name!\n"
		
	if(bill_email.length==0)	
		msg+="Please enter your Email!\n";
*/		
	if(bill_companyaddress.length==0)
		msg+="Please enter your Address!\n";
	if(bill_city.length==0)
		msg+="Please enter your City!\n";

	if(bill_zip.length==0)
		msg+="Please enter your Zip code!\n";
	if(document.signupfrm_step2.term.checked!=true)
		msg+="Please agree to the terms and conditions to continue.\n";
						
	if(msg.length > 0)
		alert(msg);	
	else
		document.signupfrm_step2.submit();	
}	

//300306

function chk_subscribed_by(frmname)
{

var msg = "", dc = eval("document." + frmname);

if(dc.R2[0].checked == false && dc.R2[1].checked == false)
	msg += "Please select a subscription status!";

if(msg.length > 0)
{
	alert(msg);
	return false;
}
else
{
	return true;
}


}

