function validatesubscribe_email()
	{

		//---------- FName  ----------
		if ( document.frmsubscribe.first_name.value == ""  )
  		 {if (!(PrintMesg(document.frmsubscribe.first_name,"Please enter First Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmsubscribe.first_name))
   		 {if (!(PrintMesg(document.frmsubscribe.first_name,"Please enter First Name other than space.")))
    		{return false;}}
		 }

				//---------- LName  ----------
		if ( document.frmsubscribe.last_name.value == ""  )
  		 {if (!(PrintMesg(document.frmsubscribe.last_name,"Please enter Last Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmsubscribe.last_name))
   		 {if (!(PrintMesg(document.frmsubscribe.last_name,"Please enter Last Name other than space.")))
    		{return false;}}
		 }

		
				//----------Address  ----------
		if (document.frmsubscribe.address.value == ""  )
  		 {if (!(PrintMesg(document.frmsubscribe.address,"Please enter Address")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmsubscribe.address))
   		 {if (!(PrintMesg(document.frmsubscribe.address,"Please enter Address other than space.")))
    		{return false;}}
		 }

			//----------Post Code  ----------

		if ( document.frmsubscribe.post_code.value == ""  )
  		 {if (!(PrintMesg(document.frmsubscribe.post_code,"Please enter Postcode")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmsubscribe.post_code))
   		 {if (!(PrintMesg(document.frmsubscribe.post_code,"Please enter Postcode other than space.")))
    		{return false;}}
		 }
	
			//----------Telephone  ----------

		if ( document.frmsubscribe.telephone.value == ""  )
  		 {if (!(PrintMesg(document.frmsubscribe.telephone,"Please enter Telephone")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmsubscribe.telephone))
   		 {if (!(PrintMesg(document.frmsubscribe.telephone,"Please enter Telephone other than space.")))
    		{return false;}}
		 }


				//--------e-mail
	mail = ""
	mail = document.frmsubscribe.submit_by.value
 	if (mail  == "")
    {if (!(PrintMesg(document.frmsubscribe.submit_by,"Please enter Email.")))
    {return false;}}
	 else { 
   	n = mail.indexOf("@")
   	if (n >= 0)
   	{ newstr = mail.substring(n)
	 n= newstr.indexOf(".")
	 if (n<0)
	    {if (!(PrintMesg(document.frmsubscribe.submit_by,"Please enter a valid E-mail Address.")))
	    {return false;}}
   	} 
   	else
    {if (!(PrintMesg(document.frmsubscribe.submit_by,"Please enter a valid E-mail Address.")))
    {return false;}}
 	}

			//-----------How did you hear
		
		if ( document.frmsubscribe.hear.value == ""  )
  		 {if (!(PrintMesg(document.frmsubscribe.hear,"Please enter How did you hear about CWI")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmsubscribe.hear))
   		 {if (!(PrintMesg(document.frmsubscribe.hear,"Please enter How did you hear about CWI other than space.")))
    		{return false;}}
		 }
		

		


			
		return true;
	}


//--------------------------------------------------




function validatecontact()
	{

		//---------- FName  ----------
		if ( document.frmcontact.first_name.value == ""  )
  		 {if (!(PrintMesg(document.frmcontact.first_name,"Please enter the Your Name.")))
   			{return false;}}
		 else  { 
   		if (!SpaceChk(document.frmcontact.first_name))
   		 {if (!(PrintMesg(document.frmcontact.first_name,"Please enter Your Name other than space.")))
    		{return false;}}
		 }

		

		 
		//--------e-mail
	mail = ""
	mail = document.frmcontact.submit_by.value
 	if (mail  == "")
    {if (!(PrintMesg(document.frmcontact.submit_by,"Please enter E-mail Address.")))
    {return false;}}
	 else { 
   	n = mail.indexOf("@")
   	if (n >= 0)
   	{ newstr = mail.substring(n)
	 n= newstr.indexOf(".")
	 if (n<0)
	    {if (!(PrintMesg(document.frmcontact.submit_by,"Please enter a valid E-mail Address.")))
	    {return false;}}
   	} 
   	else
    {if (!(PrintMesg(document.frmcontact.submit_by,"Please enter a valid E-mail Address.")))
    {return false;}}
 	}



			
		return true;
	}



function validatesubscribe()
	{
		//--------e-mail
	mail = ""
	mail = document.frmsubcribe.submit_by.value
 	if (mail  == "")
    {if (!(PrintMesg(document.frmsubcribe.submit_by,"Please enter email address.")))
    {return false;}}
	 else { 
   	n = mail.indexOf("@")
   	if (n >= 0)
   	{ newstr = mail.substring(n)
	 n= newstr.indexOf(".")
	 if (n<0)
	    {if (!(PrintMesg(document.frmsubcribe.submit_by,"Please enter a valid email address.")))
	    {return false;}}
   	} 
   	else
    {if (!(PrintMesg(document.frmsubcribe.submit_by,"Please enter a valid email address.")))
    {return false;}}
 	}



			
		return true;
	}


//prints messages
function PrintMesg(ctrlvar,mesg)
{ alert(mesg); ctrlvar.focus(); return false }

// function to check spaces
function SpaceChk(ctrlvar)
{
   chkstr     = ctrlvar.value
   stlength   = chkstr.length
   spacecount = 0
   if (stlength >0)  {
    for(i=0;i<=stlength;i++)
     if ( chkstr.charAt(i)==" ") { spacecount=spacecount+1  }
    if (stlength == spacecount) { return false }
   return true }
}


//----------popup-----------------------------------


//var newwindow = ''
//function popitup(url) {
 //if (newwindow.location && !newwindow.closed) {
  //  newwindow.location.href = url; 
  //  newwindow.focus(); } 
//else { 
  //  newwindow=window.open(url,'Popup Image','width=400,height=500,resizable=1');} 
//}




//---------------popup 13-02-08

function popitup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=400,height=500,scrollbars=no');
return false;
}

//function popup (c) {
//window.open(c,'window','width=400,height=500,scrollbars=yes,status=yes');
//}


function popup(mylink)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href,'window','width=400,height=500,scrollbars=no');
return false;
}


function tellpopup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=600,height=600,scrollbars=No');
return false;
}




