function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function loadradiolink() {
var load = window.open('http://www.nightlifelink.com/content/radiolink/player?poc=0', 'mywindow', ',width=735,height=466,resizable=yes,scrollbars=no,menubar=no');

if(navigator.appName == "Microsoft Internet Explorer"){
load = window.open('http://www.nightlifelink.com/content/radiolink/player?poc=2', 'mywindow', ',width=735,height=466,resizable=yes,scrollbars=no,menubar=no');
}
}

function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}


//*****************************************
// Blending Image Slide Show Script- 
// ? Dynamic Drive (www.dynamicdrive.com)
// For full source code, visit http://www.dynamicdrive.com/
//*****************************************
//specify interval between slide (in mili seconds)

var slidespeed			= 15000;

//var image_index			= 0;
//var link_index			= 0;
//var image_index_side	= 0;
var image_index_side1	= 0;
var image_index_side2	= 0;
var image_index_side3	= 0;
var image_index_side4	= 0;
var image_index_side5	= 0;
var image_index_side6   = 0;
var image_index_side7   = 0;
var image_index_side8   = 0;
var image_index_side9   = 0;
var image_index_side10  = 0;
var image_index_side11  = 0;
var image_index_side12  = 0;
//var link_index_side		= 0;

var newwindow=1 //open links in new window? 1=yes, 0=no
var ie=document.all

function gotoshow()
{
	if (newwindow)
		window.open(slidelinks[image_index])
}

function gotoshow_side1()
{
	if (newwindow)
		window.open(slidelinks_side[image_index_side1])
}

function gotoshow_side2()
{
	if (newwindow)
		window.open(slidelinks_side[image_index_side2])
}

function gotoshow_side3()
{
	if (newwindow)
		window.open(slidelinks_side[image_index_side3])
}

function gotoshow_side4()
{
	if (newwindow)
		window.open(slidelinks_side[image_index_side4])
}

function gotoshow_side5()
{
	if (newwindow)
		window.open(slidelinks_side[image_index_side5])
}

function gotoshow_side6()
{
	if(newwindow)
		window.open(slidelinks_side[image_index_side6])
}

function gotoshow_side7()
{
	if(newwindow)
		window.open(slidelinks_side[image_index_side7])
}

function gotoshow_side8()
{
	if(newwindow)
		window.open(slidelinks_side[image_index_side8])
}

function gotoshow_side9()
{
	if(newwindow)
		window.open(slidelinks_side[image_index_side9])
}

function gotoshow_side10()
{
	if(newwindow)
		window.open(slidelinks_side[image_index_side10])
}

function gotoshow_side11()
{
	if(newwindow)
		window.open(slidelinks_side[image_index_side11])
}

function gotoshow_side12()
{
	if(newwindow)
		window.open(slidelinks_side[image_index_side12])
}

function generate(x, y) 
{
	var range = y - x + 1;
	return Math.floor(Math.random() * range) + x;
}

function create_unique_random_array(num_elements,my_min,my_max)
{
    var temp, nums = new Array;

    for (var element=0; element<num_elements; element++)
	{
		//IMPORTANT: DON'T FORGET THE SEMI-COLON AT THE END
		while((temp=number_found(random_number(my_min,my_max),nums))==-1);
		nums[element] = temp;
	}
    return (nums)
}

function number_found (random_number,number_array)
{
    for (var element=0; element<number_array.length; element++)
	{
		if (random_number==number_array[element])
		return (-1);
	}
    return (random_number);
}


// RETURNS PSEUDO-RANDOM NUMBER IN RANGE min...max
function random_number( my_min, my_max )
{
	return (Math.round((my_max-my_min) * Math.random() + my_min));
} 


function getNextImage() 
{
	var number_of_image = slideimages.length;
	image_index = generate(0, number_of_image-1);
	var new_image = slideimages[image_index];
	return(new_image);
}

bannerRandomArray = new Array;

function getNextImageSide1() 
{
	// The location.search property has a "?"
	// at the start, get the part that follows
	var querystring = location.search.substring(1, location.search.length);

	// Check if a score has been passed
	var stateVar = querystring.indexOf('state_name=');
	var state = null;

	// If it has...
	if(stateVar != -1)
	{
		// There are six characters in "score=",
		// isolate the score value
		var state1 = querystring.charAt(stateVar + 11);
		var state2 = querystring.charAt(stateVar + 12);

		state = state1+state2;
	} 

	if (state==null) 
	{
		//bannerRandomArray = create_unique_random_array( 12, 0, 11 );
		bannerRandomArray = create_unique_random_array( 5, 0, 4 );
	}	
	//else if (state=="DE" || state=="NY" || state=="GA" || state=="PA" || state=="NJ" || state=="DC" || state=="NV" || state=="FL") 
	//{
	//	bannerRandomArray = create_unique_random_array( 10, 0, 9 );
	//}
	else 
	{
		bannerRandomArray = create_unique_random_array( 10, 0, 9 );
		//bannerRandomArray = create_unique_random_array( 5, 0, 4 );
	}

	//alert(state);

	var number_of_image_side = slideimages_side.length;
	image_index_side1 = bannerRandomArray[0];//generate(0, number_of_image_side-1);
	var new_image_side = slideimages_side[image_index_side1];
	return(new_image_side);
}
   
function getNextImageSide2() 
{
	var number_of_image_side = slideimages_side.length;
	image_index_side2 = bannerRandomArray[1];//generate(0, number_of_image_side-1);
	var new_image_side = slideimages_side[image_index_side2];
	return(new_image_side);
}

function getNextImageSide3() 
{
	var number_of_image_side = slideimages_side.length;
	image_index_side3 = bannerRandomArray[2];//generate(0, number_of_image_side-1);
	var new_image_side = slideimages_side[image_index_side3];
	return(new_image_side);
}

function getNextImageSide4() 
{
	var number_of_image_side = slideimages_side.length;
	image_index_side4 = bannerRandomArray[3];//generate(0, number_of_image_side-1);
	var new_image_side = slideimages_side[image_index_side4];
	return(new_image_side);
}

function getNextImageSide5() 
{
	var number_of_image_side = slideimages_side.length;
	image_index_side5 = bannerRandomArray[4];//generate(0, number_of_image_side-1);
	var new_image_side = slideimages_side[image_index_side5];
	return(new_image_side);
}

function getNextImageSide6()
{
	var number_of_image_side = slideimages_side.length;
	image_index_side6 = bannerRandomArray[5];
	var new_image_side = slideimages_side[image_index_side6];
	return(new_image_side);
}

function getNextImageSide7()
{
	var number_of_image_side = slideimages_side.length;
	image_index_side7 = bannerRandomArray[6];
	var new_image_side = slideimages_side[image_index_side7];
	return(new_image_side);
}

function getNextImageSide8()
{
	var number_of_image_side = slideimages_side.length;
	image_index_side8 = bannerRandomArray[7];
	var new_image_side = slideimages_side[image_index_side8];
	return(new_image_side);
}

function getNextImageSide9()
{
	var number_of_image_side = slideimages_side.length;
	image_index_side9 = bannerRandomArray[8];
	var new_image_side = slideimages_side[image_index_side9];
	return(new_image_side);
}

function getNextImageSide10()
{
	var number_of_image_side = slideimages_side.length;
	image_index_side10 = bannerRandomArray[9];
	var new_image_side = slideimages_side[image_index_side10];
	return(new_image_side);
} 

function getNextImageSide11()
{
	var number_of_image_side = slideimages_side.length;
	image_index_side11 = bannerRandomArray[10];
	var new_image_side = slideimages_side[image_index_side11];
	return(new_image_side);
}

function getNextImageSide12()
{
	var number_of_image_side = slideimages_side.length;
	image_index_side12 = bannerRandomArray[11];
	var new_image_side = slideimages_side[image_index_side12];
	return(new_image_side);
}

function getDocheight()
{ 
	docheight = document.getElementById("marker").offsetTop; 
	adjDocHeight = docheight-300
	alert(adjDocHeight); 
} 

function clearDefault(email) 
{
  if (email.defaultValue==email.value) 
  	email.value = ""
}

//function clearDefault(email) 
//{
//  if (name.defaultValue==name.value) 
//  	name.value = ""
//}

function validateEmailAddress(form)
{
	var errString = "";

    var sqlQuery  = "";

            
    if(form.state.selectedIndex == 0 || !EmailValidator(form))
    {
       errString += "Please enter a valid email address and select your state\n";
    }                              

    if(errString == "")
    { 
		form.action = "http://optin.verticalresponse.com/";
      	form.submit(); 
    }
    else
    {
        alert(errString);
    }
} 


function indexSearch(form)

{

    var errString = "";

    var sqlQuery  = "";

            

    if(form.state_name.selectedIndex == 0 || form.search_date.selectedIndex == 0)

    {

       errString += "Select an Area and Date Range below then click 'Search'\n";

    }    

                             

    if(errString == "")

    { 

		form.action = "http://www.nightlifelink.com/content/search/search.jsp?type=general&state_name="+form.state_name.value;

      	form.submit(); 

    }

    else

    {

        alert(errString);

    }

}


function promoterSearch(form)

{

    var errString = "";

    var sqlQuery  = "";

    

	if(form.promoter_id.value == 000)

    {

        errString += "Please Enter a PIN\n";

    }                                        

    if(errString == "")

    {

		form.action = "http://www.nightlifelink.com/content/search.jsp?type=promoter";

      	form.submit();

    }

    else

    {

        alert(errString);

    }

}


function addEmail(form)

{

    var errString = "";
    var sqlQuery  = "";
	
	if(form.email.value == "E-mail Address")

    {

        errString += "Please Enter an E-mail Address\n";

    }                                        

    if(errString == "")

    {

		form.action = "pMailingListGuestList.jsp";

      	form.submit();

    }

    else

    {

        alert(errString);

    }

}


function venueSearch(form)

{

    var errString = "";

    var sqlQuery  = "";

    

	if(form.venue_id1.value == 00 && form.venue_id2.value == 00)

    {

        errString += "Enter an Event Id\n";

    }                                        

    if(errString == "")

    {

		form.action = "http://www.nightlifelink.com/content/search/search.jsp?type=venue";

      	form.submit();

    }

    else

    {

        alert(errString);

    }

}



function isEmailAddr(email)

{

  var result = false

  var theStr = new String(email)

  var index = theStr.indexOf("@");

  if (index > 0)

  {

    var pindex = theStr.indexOf(".",index);

    if ((pindex > index+1) && (theStr.length > pindex+1))

	result = true;

  }

  return result;

}



function EmailValidator(theForm)
{
  if (theForm.email_address.value == "")
  { 
    //alert("Please enter a value for the \"email\" field.");

    //theForm.email.focus();

    return (false);

  }



  if (!isEmailAddr(theForm.email_address.value))

  {

    //alert("Please enter a complete email address in the form: yourname@yourdomain.com");

    //theForm.email.focus();

    return (false);

  }

   

  if (theForm.email_address.value.length < 3)

  {

    //alert("Please enter at least 3 characters in the \"email\" field.");

    //theForm.email.focus();

    return (false);

  }

  
  /*
  if (theForm.list_type.value == "email_list")

  {

  	window.open('http://www.nightlifelink.com/emailAddressSubmit.html','Mailing_List','status,scrollbars,width=300,height=100,left=10,top=10');

  }



  if (theForm.list_type.value == "guest_list")

  {

	window.open('http://www.nightlifelink.com/guestlistSignUpSubmit.html','Guest_List','status,scrollbars,width=300,height=100,left=10,top=10');

  } */ 

    

  return (true);

}



function populateData( name ) 

{ 

	var arrayData = new Array(); 

	 

	arrayData[0]	= 'CA| Los Angeles|'

	arrayData[1]	= 'DE| Wilmington|'

	arrayData[2]	= 'FL| Miami|' 

	arrayData[3]	= 'FL| Orlando|'

	arrayData[4]	= 'GA| Atlanta|'  

	arrayData[5]	= 'GA| Roswell|' 

	arrayData[6]	= 'GA| Buckhead|' 

	arrayData[7]	= 'IL| Chicago|' 

	arrayData[8]	= 'NJ| Asbury Park|'  

	arrayData[9]	= 'NJ| Belleville|' 

	arrayData[10]	= 'NJ| Bloomfield|' 

	arrayData[11]	= 'NJ| Camden|' 

	arrayData[12]	= 'NJ| Denville|' 

	arrayData[13]	= 'NJ| Elizabeth|' 

	arrayData[14]	= 'NJ| Englewood|' 

	arrayData[15]	= 'NJ| Englewood Cliffs|' 

	arrayData[16]	= 'NJ| Fairview|' 

	arrayData[17]	= 'NJ| Fort Lee|' 

	arrayData[18]	= 'NJ| Garfield|' 

	arrayData[19]	= 'NJ| Hackensack|' 

	arrayData[20]	= 'NJ| Lodi|' 

	arrayData[21]	= 'NJ| Lyndhurst|' 

	arrayData[22]	= 'NJ| Montclair|' 

	arrayData[23]	= 'NJ| New Brunswick|' 

	arrayData[24]	= 'NJ| Newark|' 

	arrayData[25]	= 'NJ| Paramus|' 

	arrayData[26]	= 'NJ| Passaic|' 

	arrayData[27]	= 'NJ| Paterson|' 

	arrayData[28]	= 'NJ| Perth Amboy|' 

	arrayData[29]	= 'NJ| Plainfield|' 

	arrayData[30]	= 'NJ| Sayreville|' 

	arrayData[31]	= 'NJ| Teaneck|' 

	arrayData[32]	= 'NJ| Totowa|' 

	arrayData[33]	= 'NY| Manhattan|'

	arrayData[34]	= 'PA| Philadelphia|' 

	arrayData[35]	= 'VA| Norfolk|' 

	arrayData[36]	= 'VA| Va Beach|' 

	arrayData[37]	= 'CA| Hollywood|'
	arrayData[38]	= 'CA| Los Angeles|'
	arrayData[0]	= 'CA| Los Angeles|'

			

	select	= window.document.form.venue_city; 

	string	= ""; 

 

	count	= 0; 

 

	select.options.length = count; 

 

	for( i = 0; i < arrayData.length; i++ ) 

	{ 

		string = arrayData[i].split( "|" ); 

		if( string[0] == name ) 

		{ 

			select.options[count++] = new Option( string[1] ); 

		} 

	}  

} 



function populateData1( name ) 

{ 

	var arrayData = new Array(); 

	 

	//arrayData[0]	= 'NJ| New Jersey Area|'

	arrayData[0]	= 'NJ|State Search|'

	arrayData[1]	= 'NY|State Search|' 

	arrayData[2]	= 'DE|State Search|'  

	arrayData[3]	= 'PA|State Search|' 

	arrayData[4]	= 'IL|Chicago Area|'

	arrayData[5]	= 'GA|State Search|'
	arrayData[6]	= 'CA|State Search|'
	arrayData[7]	= 'CT|State Search|'
	arrayData[8]	= 'VA|State Search|'
	arrayData[9]	= 'DC|State Search|'
	arrayData[10]	= 'MD|State Search|'
	arrayData[11]	= 'SC|State Search|'
  
	select	= window.document.form.search_area_name; 

	string	= ""; 

 

	count	= 0; 

 

	select.options.length = count; 

 

	for( i = 0; i < arrayData.length; i++ ) 

	{ 

		string = arrayData[i].split( "|" ); 

		if( string[0] == name ) 

		{ 

			select.options[count++] = new Option( string[1] ); 

		} 

	}  

} 



function indexAddEvent(form)

{

    var errString = "";

    var sqlQuery  = "";     

                             

    if(errString == "")

    {

		form.action = "iuEvent.jsp";

      	form.submit(); 

    }

    else

    {

        alert(errString);

    }

}



<!-- Copyright 2003 Bontrager Connection, LLC
// Code obtained from http://WillMaster.com/
//
// Each required form field can be checked with JavaScript. Here are 
//    the function names for the different kinds of checks:
//
//       1. WithoutContent() -- check if the text, textarea, password, 
//              or file fields has no content.
//       2. NoneWithContent() -- check if none of the set of text, 
//              textarea, password, or file fields have content. 
//              (Set: More than one with the same field name.)
//
//       3. NoneWithCheck() -- check if none of the set of radio buttons 
//              or checkboxes are checked. (Set: More than one with the 
//              same field name.)
//       4. WithoutCheck() -- check if the single radio button or checkbox 
//              is unchecked.
//
//       5. WithoutSelectionValue() -- check if selected drop-down list or 
//              select box entries have no value.
//
//
// The format for using the above functions is
//             if(       WithoutContent([FORMFIELDVALUE])) [ERRORMESSAGE]
//             if(      NoneWithContent([FORMFIELD])     ) [ERRORMESSAGE]
//             if(        NoneWithCheck([FORMFIELD])     ) [ERRORMESSAGE]
//             if(         WithoutCheck([FORMFIELD])     ) [ERRORMESSAGE]
//             if(WithoutSelectionValue([FORMFIELD])     ) [ERRORMESSAGE]
//
// The if(...) part and the error message part may be on separate lines, like
//             if(WithoutContent([FORMFIELDVALUE]))
//                [ERRORMESSAGE]
//             if(NoneWithContent([FORMFIELD]))
//                [ERRORMESSAGE]
//             if(NoneWithCheck([FORMFIELD]))
//                [ERRORMESSAGE]
//             if(WithoutCheck([FORMFIELD]))
//                [ERRORMESSAGE]
//             if(WithoutSelectionValue([FORMFIELD]))
//                [ERRORMESSAGE]
//
//
//      FORMFIELD -- The format for specifying a "form field" is 
//                         document.[FORMNAME].[FIELDNAME]
// FORMFIELDVALUE -- The format for specifying a "form field value" is 
//                         document.[FORMNAME].[FIELDNAME].value
//   ERRORMESSAGE -- The format for specifying an "error message" is
//                         { errormessage += "\n\n[MESSAGE]"; }
//                   If the message itself contains quotation marks, 
//                      they must be preceded with a back slash. 
//                      Example: \"
//
//
//      FORMNAME -- The name assigned to the form in the <FORM... tag. 
//     FIELDNAME -- The field name being checked.
// 
//
// For use with this JavaScript, the only non-alphanumeric character a 
//    fieldname may have is the underscore. Replace any hyphens, colons, 
//    spaces, or other non-alphanumeric characters in your field names 
//    with an underscore character.
//
//
// Put field checks into the function CheckRequiredFields(), in the order 
//    you want the fields checked.
//
function emailCheck (emailStr) {

/* The following variable tells the rest of the function whether or not
to verify that the address ends in a two-letter country or well-known
TLD.  1 means check it, 0 means don't. */

var checkTLD=1;

/* The following is the list of known TLDs that an e-mail address must end with. */

var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

/* The following pattern is used to check if the entered e-mail address
fits the user@domain format.  It also is used to separate the username
from the domain. */

var emailPat=/^(.+)@(.+)$/;

/* The following string represents the pattern for matching all special
characters.  We don't want to allow special characters in the address. 
These characters include ( ) < > @ , ; : \ " . [ ] */

var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

/* The following string represents the range of characters allowed in a 
username or domainname.  It really states which chars aren't allowed.*/

var validChars="\[^\\s" + specialChars + "\]";

/* The following pattern applies if the "user" is a quoted string (in
which case, there are no rules about which characters are allowed
and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
is a legal e-mail address. */

var quotedUser="(\"[^\"]*\")";

/* The following pattern applies for domains that are IP addresses,
rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
e-mail address. NOTE: The square brackets are required. */

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

/* The following string represents an atom (basically a series of non-special characters.) */

var atom=validChars + '+';

/* The following string represents one word in the typical username.
For example, in john.doe@somewhere.com, john and doe are words.
Basically, a word is either an atom or quoted string. */

var word="(" + atom + "|" + quotedUser + ")";

// The following pattern describes the structure of the user

var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

/* The following pattern describes the structure of a normal symbolic
domain, as opposed to ipDomainPat, shown above. */

var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

/* Finally, let's start trying to figure out if the supplied address is valid. */

/* Begin with the coarse pattern to simply break up user@domain into
different pieces that are easy to analyze. */

var matchArray=emailStr.match(emailPat);

if (matchArray==null) {

/* Too many/few @'s or something; basically, this address doesn't
even fit the general mould of a valid e-mail address. */

alert("Email address seems incorrect (check @ and .'s)");
return false;
}
var user=matchArray[1];
var domain=matchArray[2];

// Start by checking that only basic ASCII characters are in the strings (0-127).

for (i=0; i<user.length; i++) {
if (user.charCodeAt(i)>127) {
alert("Ths username contains invalid characters.");
return false;
   }
}
for (i=0; i<domain.length; i++) {
if (domain.charCodeAt(i)>127) {
alert("Ths domain name contains invalid characters.");
return false;
   }
}

// See if "user" is valid 

if (user.match(userPat)==null) {

// user is not valid

alert("The username doesn't seem to be valid.");
return false;
}

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

var IPArray=domain.match(ipDomainPat);
if (IPArray!=null) {

// this is an IP address

for (var i=1;i<=4;i++) {
if (IPArray[i]>255) {
alert("Destination IP address is invalid!");
return false;
   }
}
return true;
}

// Domain is symbolic name.  Check if it's valid.
 
var atomPat=new RegExp("^" + atom + "$");
var domArr=domain.split(".");
var len=domArr.length;
for (i=0;i<len;i++) {
if (domArr[i].search(atomPat)==-1) {
alert("The domain name does not seem to be valid.");
return false;
   }
}

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

if (checkTLD && domArr[domArr.length-1].length!=2 && 
domArr[domArr.length-1].search(knownDomsPat)==-1) {
alert("The address must end in a well-known domain or two letter " + "country.");
return false;
}

// Make sure there's a host name preceding the domain.

if (len<2) {
alert("This address is missing a hostname!");
return false;
}

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


function CheckRequiredFields() {
var errormessage = new String();
// Put field checks below this point.

if(WithoutContent(document.exampleform.eventname.value))
	{ errormessage += "\n\nPlease type something in the \"Event Name\" text field."; }
if(WithoutContent(document.exampleform.eventdate.value))
	{ errormessage += "\n\nPlease type something in the \"Event Date\" text field."; }	
if(WithoutContent(document.exampleform.eventvenue.value))
	{ errormessage += "\n\nPlease type something in the \"Event Venue\" text field."; }
if(WithoutContent(document.exampleform.venueaddress.value))
	{ errormessage += "\n\nPlease type something in the \"Venue Address\" text field."; }
if(WithoutContent(document.exampleform.city.value))
	{ errormessage += "\n\nPlease type something in the \"City\" text field."; }
if(WithoutSelectionValue(document.exampleform.state))
	{ errormessage += "\n\nPlease select a State from the dropdown list."; }
if(WithoutContent(document.exampleform.contactemail.value))
	{ errormessage += "\n\nPlease type something in the \"Contact E-mail\" text field."; }
if(WithoutContent(document.exampleform.eventstarttime.value))
	{ errormessage += "\n\nPlease type something in the \"Event Start Time\" text field."; }
if(WithoutContent(document.exampleform.eventendtime.value))
	{ errormessage += "\n\nPlease type something in the \"Event End Time\" text field."; }
if(WithoutContent(document.exampleform.eventcover.value))
	{ errormessage += "\n\nPlease type something in the \"Event Cover\" text field."; }
if(WithoutContent(document.exampleform.eventdresscode.value))
	{ errormessage += "\n\nPlease type something in the \"Event Dress Code\" text field."; }

//emailCheck(document.exampleform.contactemail.value);

// Put field checks above this point.
if(errormessage.length > 2) {
	alert('NOTE:' + errormessage);
	return false;
	}
return true;
} // end of function CheckRequiredFields()


function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}

function NoneWithContent(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].value.length > 0) { return false; }
	}
return true;
}

function NoneWithCheck(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].checked) { return false; }
	}
return true;
}

function WithoutCheck(ss) {
if(ss.checked) { return false; }
return true;
}

function WithoutSelectionValue(ss) {
for(var i = 0; i < ss.length; i++) {
	if(ss[i].selected) {
		if(ss[i].value.length) { return false; }
		}
	}
return true;
}

// Title: Tigra Calendar
// URL: http://www.softcomplex.com/products/tigra_calendar/
// Version: 3.4 (mySQL format)
// Date: 07/12/2007
// Note: Permission given to use this script in ANY kind of applications if
//    header lines are left unchanged.
// Note: Script consists of two files: calendar?.js and calendar.html

// if two digit year input dates after this year considered 20 century.
var NUM_CENTYEAR = 30;
// is time input control required by default
var BUL_TIMECOMPONENT = false;
// are year scrolling buttons required by default
var BUL_YEARSCROLL = true;

var calendars = [];
var RE_NUM = /^\-?\d+$/;

function calendar3(obj_target) {

	// assigning methods
	this.gen_date = cal_gen_date3;
	this.gen_time = cal_gen_time3;
	this.gen_tsmp = cal_gen_tsmp3;
	this.prs_date = cal_prs_date3;
	this.prs_time = cal_prs_time3;
	this.prs_tsmp = cal_prs_tsmp3;
	this.popup    = cal_popup3;

	// validate input parameters
	if (!obj_target)
		return cal_error("Error calling the calendar: no target control specified");
	if (obj_target.value == null)
		return cal_error("Error calling the calendar: parameter specified is not valid target control");
	this.target = obj_target;
	this.time_comp = BUL_TIMECOMPONENT;
	this.year_scroll = BUL_YEARSCROLL;
	
	// register in global collections
	this.id = calendars.length;
	calendars[this.id] = this;
}

function cal_popup3 (str_datetime) {
	if (str_datetime)
		this.dt_current = this.prs_tsmp(str_datetime);
	else 
		this.dt_selected = this.dt_current = this.prs_tsmp(this.target.value);

	if (!this.dt_current) return;

	var obj_calwindow = window.open(
		'http://www.nightlifelink.com/content/addevent/calendar.html?id=' + this.id + '&s=' + this.dt_selected.valueOf() + '&c=' + this.dt_current.valueOf(),
		'Calendar', 'width=200,height=' + (this.time_comp ? 215 : 190) +
		',status=no,resizable=no,top=200,left=200,dependent=yes,alwaysRaised=yes'
	);
	obj_calwindow.opener = window;
	obj_calwindow.focus();
}

// timestamp generating function
function cal_gen_tsmp3 (dt_datetime) {
	return(this.gen_date(dt_datetime) + ' ' + this.gen_time(dt_datetime));
}

// date generating function
function cal_gen_date3 (dt_datetime) {
	return (
		dt_datetime.getFullYear() + "-"
		+ (dt_datetime.getMonth() < 9 ? '0' : '') + (dt_datetime.getMonth() + 1) + "-"
		+ (dt_datetime.getDate() < 10 ? '0' : '') + dt_datetime.getDate()
	);
}
// time generating function
function cal_gen_time3 (dt_datetime) {
	return (
		(dt_datetime.getHours() < 10 ? '0' : '') + dt_datetime.getHours() + ":"
		+ (dt_datetime.getMinutes() < 10 ? '0' : '') + (dt_datetime.getMinutes()) + ":"
		+ (dt_datetime.getSeconds() < 10 ? '0' : '') + (dt_datetime.getSeconds())
	);
}

// timestamp parsing function
function cal_prs_tsmp3 (str_datetime) {
	// if no parameter specified return current timestamp
	if (!str_datetime)
		return (new Date());

	// if positive integer treat as milliseconds from epoch
	if (RE_NUM.exec(str_datetime))
		return new Date(str_datetime);
		
	// else treat as date in string format
	var arr_datetime = str_datetime.split(' ');
	return this.prs_time(arr_datetime[1], this.prs_date(arr_datetime[0]));
}

// date parsing function
function cal_prs_date3 (str_date) {

	var arr_date = str_date.split('-');

	if (arr_date.length != 3) return alert ("Invalid date format: '" + str_date + "'.\nFormat accepted is yyyy-mm-dd.");

	if (!arr_date[0]) return alert ("Invalid date format: '" + str_date + "'.\nNo year value can be found.");
	if (!RE_NUM.exec(arr_date[0])) return alert ("Invalid year value: '" + arr_date[0] + "'.\nAllowed values are unsigned integers.");

	if (!arr_date[1]) return alert ("Invalid date format: '" + str_date + "'.\nNo month value can be found.");
	if (!RE_NUM.exec(arr_date[1])) return alert ("Invalid month value: '" + arr_date[1] + "'.\nAllowed values are unsigned integers.");

	if (!arr_date[2]) return alert ("Invalid date format: '" + str_date + "'.\nNo day of month value can be found.");
	if (!RE_NUM.exec(arr_date[2])) return alert ("Invalid day of month value: '" + arr_date[2] + "'.\nAllowed values are unsigned integers.");



	var dt_date = new Date();
	dt_date.setDate(1);

	if (arr_date[0] < 100) arr_date[0] = Number(arr_date[0]) + (arr_date[0] < NUM_CENTYEAR ? 2000 : 1900);
	dt_date.setFullYear(arr_date[0]);


	if (arr_date[1] < 1 || arr_date[1] > 12) return alert ("Invalid month value: '" + arr_date[1] + "'.\nAllowed range is 01-12.");
	dt_date.setMonth(arr_date[1] - 1);
	 

	var dt_numdays = new Date(arr_date[0], arr_date[1], 0);
	dt_date.setDate(arr_date[2]);
	if (dt_date.getMonth() != (arr_date[1]-1)) return alert ("Invalid day of month value: '" + arr_date[2] + "'.\nAllowed range is 01-"+dt_numdays.getDate()+".");

	return (dt_date)
}

// time parsing function
function cal_prs_time3 (str_time, dt_date) {

	if (!dt_date) return null;
	var arr_time = String(str_time ? str_time : '').split(':');

	if (!arr_time[0]) dt_date.setHours(0);
	else if (RE_NUM.exec(arr_time[0])) 
		if (arr_time[0] < 24) dt_date.setHours(arr_time[0]);
		else return cal_error ("Invalid hours value: '" + arr_time[0] + "'.\nAllowed range is 00-23.");
	else return cal_error ("Invalid hours value: '" + arr_time[0] + "'.\nAllowed values are unsigned integers.");
	
	if (!arr_time[1]) dt_date.setMinutes(0);
	else if (RE_NUM.exec(arr_time[1]))
		if (arr_time[1] < 60) dt_date.setMinutes(arr_time[1]);
		else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed range is 00-59.");
	else return cal_error ("Invalid minutes value: '" + arr_time[1] + "'.\nAllowed values are unsigned integers.");

	if (!arr_time[2]) dt_date.setSeconds(0);
	else if (RE_NUM.exec(arr_time[2]))
		if (arr_time[2] < 60) dt_date.setSeconds(arr_time[2]);
		else return cal_error ("Invalid seconds value: '" + arr_time[2] + "'.\nAllowed range is 00-59.");
	else return cal_error ("Invalid seconds value: '" + arr_time[2] + "'.\nAllowed values are unsigned integers.");

	dt_date.setMilliseconds(0);
	return dt_date;
}

function cal_error (str_message) {
	alert (str_message);
	return null;
}