/*
	This code is to allow Javascript to communcted to the Server in order to update it
*/

//
// Define a list of Microsoft XML HTTP ProgIDs.
//
var XMLHTTPREQUEST_MS_PROGIDS = new Array(
  "Msxml2.XMLHTTP.7.0",
  "Msxml2.XMLHTTP.6.0",
  "Msxml2.XMLHTTP.5.0",
  "Msxml2.XMLHTTP.4.0",
  "MSXML2.XMLHTTP.3.0",
  "MSXML2.XMLHTTP",
  "Microsoft.XMLHTTP"
);

//
// Define ready state constants.
//
var XMLHTTPREQUEST_READY_STATE_UNINITIALIZED = 0;
var XMLHTTPREQUEST_READY_STATE_LOADING       = 1;
var XMLHTTPREQUEST_READY_STATE_LOADED        = 2;
var XMLHTTPREQUEST_READY_STATE_INTERACTIVE   = 3;
var XMLHTTPREQUEST_READY_STATE_COMPLETED     = 4;

//
// Returns XMLHttpRequest object. 
//
function getXMLHttpRequest()
{
  var httpRequest = null;

  // Create the appropriate HttpRequest object for the browser.
  if (window.XMLHttpRequest != null)
    httpRequest = new window.XMLHttpRequest();
  else if (window.ActiveXObject != null)
  {
    // Must be IE, find the right ActiveXObject.
    var success = false;
    for (var i = 0;i < XMLHTTPREQUEST_MS_PROGIDS.length && !success;i++)
    {
      try
      {
        httpRequest = new ActiveXObject(XMLHTTPREQUEST_MS_PROGIDS[i]);
        success = true;
      }
      catch (ex)
      {}
    }
  }

  // Display an error if we couldn't create one.
  if (httpRequest == null)
    alert("Error in HttpRequest():\n\n"
      + "Cannot create an XMLHttpRequest object.");

  // Return it.
  return httpRequest;
}//end of getXMLHttpRequest()

//Adds text to any part of the body of a HTML
function addNode(tagParent,strText,boolAddToBack, boolRemoveNode)
{
  var strNode = document.createTextNode(strText);//holds the test which will be added
     
  //gets the properties of the node
  tagParent = getDocID(tagParent);
  
  //checks if the user whats to replace the node in order to start with a clean slate
  //it also checks if there is a chode node to replace
  if (boolRemoveNode == true && tagParent.childNodes.length > 0)
	//replaces the current node with what the user wants
	tagParent.replaceChild(strNode,tagParent.childNodes[0]);
  else
  {
  	//checks if the user whats to added to the back of the id or the front
  	if(boolAddToBack == true)
		tagParent.appendChild(strNode);
  	else
		//This is a built-in function of Javascript will add text to the beginning of the child
  		insertBefore(strNode,tagParent.firstChild);
  }//end of if else
  
  //returns the divParent in order for the user to use it for more uses
  return tagParent;
}//end of addNode()

//changes the colour of tagTarget to be more dim or removes it
function changeColour(tagTarget)
{
	//gets the properties of tagTarget
	tagTarget = getDocID(tagTarget);

	//checks if there is a tagTarget on the page
	if(tagTarget != null)
	{
		//sets the style to be dim or to remove it
		if(tagTarget.style.opacity == "")
		{
			tagTarget.style.opacity = "0.5";
			tagTarget.style.filter = "alpha(opacity=50)";
		}//end of if
		else
		{
			tagTarget.style.opacity = "";
			tagTarget.style.filter = "";
		}//end of else
	}//end of if
}//end of changeColour()

//changes the image of tagImage to what is in strImageSrc
function changeImage(tagImage,strImageSrc)
{
	//gets the properties of tagImage
	tagImage = getDocID(tagImage);
	
	//checks if there is a properties
	if(tagImage != null)
		tagImage.src = strImageSrc;
}//end of changeImage()

//changes two images are the beginning and end
function changeTwoImages(tagBeginImage,tagEndImage,strBeginImage,strEndImage)
{
	//gets the properties of the tags
	tagBeginImage = getDocID(tagBeginImage);
	tagEndImage = getDocID(tagEndImage);
	
	//checks if there is a tagTarget on the page
	if(tagBeginImage != null && tagEndImage != null)
	{
		//sets the style to be the new iamge
		if(strBeginImage != "" && strEndImage != "")
		{
			tagBeginImage.src = strBeginImage;
			tagEndImage.src = strEndImage;
		}//end of if
	}//end of if
}//end of changeTwoImages()

//changes the Text Header and the Image in order for Picture Gallery can display the image fully
function changeImageLightBox(tagImage,tagLightBoxTitle,strImage,strLightBoxTitle,tagTitleBar,strStyleName)
{
	//gets the properties of the tags
	tagImage = getDocID(tagImage);
	tagLightBoxTitle = getDocID(tagLightBoxTitle);
	tagTitleBar = getDocID(tagTitleBar);
	
	//checks if there is a LightBox Title to Change
	if(tagLightBoxTitle != null)
		tagLightBoxTitle.innerHTML = strLightBoxTitle;
		
	//checks if there is a tagTarget on the page
	if(tagImage != null)
	{
		//sets the style to be the new iamge
		if(strImage != "")
		{			
			tagImage.src = strImage;
						
			//checks if the width is bigger then height
			if(tagImage.width > tagImage.height)
			{
				tagImage.width = 500;
				tagImage.height = 375;
			}//end of if
			else if(tagImage.height > 375)
				tagImage.height = 375;	
		}//end of if
	}//end of if
	
	//checks if there is a TItle Bar to move in order for the Image to be as big as it wants to be
	if(tagTitleBar != null)
	{
		var intTitleBarStyle = 0;
		
		//checks if the form is IE or the other broswers this is to see if it is need to grow th size to
		//fit the boarder and removes the px at the end of the area
		if (tagTitleBar.currentStyle)
			//IE
			intTitleBarStyle = parseInt(tagTitleBar.currentStyle[strStyleName].substring(0,tagTitleBar.currentStyle[strStyleName].length - 2));
		else
			//other broswers
			intTitleBarStyle = parseInt(document.defaultView.getComputedStyle(tagTitleBar,null).getPropertyValue(strStyleName).substring(0,document.defaultView.getComputedStyle(tagTitleBar,null).getPropertyValue(strStyleName).length - 2));

		//checks if it is need size needs to grow
		if(tagImage.width > intTitleBarStyle)
			tagTitleBar.style.width = (tagImage.width) + "px";
		else
			//removes the style
			tagTitleBar.style.width = '';
	}//end of if
}//end of changeImageLightBox()

//removes from view all tags in tagContainer with the expection of tagActive but goes the other way from classToggleLayer
//It assumes the tagActive and tagContiner already have the properties
function classRevToggleLayer(tagContainer,tagActive,strClassName,strTAGName)
{
	var arrTAG = tagContainer.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	
	//goes around the for each tag that getElementsByTagName found in tagContainter
	for(var intIndex = arrTAG.length - 1; intIndex > -1 ; intIndex--) 
	{
		//checks if the class name is the same as strClassName and it is not active if it is active then change the dispaly to block
		if(arrTAG[intIndex].className == strClassName && arrTAG[intIndex].id != tagActive.id)
			arrTAG[intIndex].style.display = arrTAG[intIndex].style.display? "":"block";
		else if(arrTAG[intIndex].id == tagActive.id && tagActive.style.display == "")
			arrTAG[intIndex].style.display = arrTAG[intIndex].style.display? "":"";
	}//end of for loop
}//end of classRevToggleLayer()

//removes from view all tags in tagContainer with the expection of tagActive
//It assumes the tagActive and tagContiner already have the properties
function classToggleLayer(tagContainer,tagActive,strClassName,strTAGName)
{
	var arrTAG = tagContainer.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	
	//goes around the for each tag that getElementsByTagName found in tagContainter
	for(var intIndex = arrTAG.length - 1; intIndex > -1 ; intIndex--) 
	{
		//checks if the class name is the same as strClassName and it is not active if it is active then change the dispaly to block
		if(arrTAG[intIndex].className == strClassName && arrTAG[intIndex].id != tagActive.id)
			arrTAG[intIndex].style.display = arrTAG[intIndex].style.display? "":"";
		else if(arrTAG[intIndex].id == tagActive.id && tagActive.style.display == "")
			arrTAG[intIndex].style.display = arrTAG[intIndex].style.display? "":"block";
	}//end of for loop
}//end of classToggleLayer()

//removes from view all tags in tagContainer with the expection of tagActive and adds color if the user choose to
//It assumes the tagActive and tagContiner already have the properties
function classToggleLayerColor(tagContainer,tagActive,strClassName,strTAGName,strNonActiveColor,strActiveColor)
{
	var arrTAG = tagContainer.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	
	//goes around the for each tag that getElementsByTagName found in tagContainter
	for(var intIndex = arrTAG.length - 1; intIndex > -1 ; intIndex--) 
	{
		//checks if the class name is the same as strClassName
		if(arrTAG[intIndex].className == strClassName && arrTAG[intIndex].id != tagActive.id)
		{
			//if strNonActiveColor is blank then it will remove the style.color
			arrTAG[intIndex].style.color = strNonActiveColor;
		}//end of if
		else if(arrTAG[intIndex].id == tagActive.id && tagActive.style.display == "")
		{
			//checks if the user wants to change color of the strTAGName
			if(strActiveColor != "")
				arrTAG[intIndex].style.color = strActiveColor;
		}//end of if else
	}//end of for loop
}//end of classToggleLayerColor()

//removes from view all tags in tagContainer with the expection of Image Active and adds the images to the non active image
//It assumes the tagActive and tagContiner already have the properties
function classToggleLayerImg(tagContainer,tagActive,strClassName,strTAGName,strActiveImg,strNonActiveImg)
{
	var arrTAG = tagContainer.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	
	//goes around the for each tag that getElementsByTagName found in tagContainter
	for(var intIndex = arrTAG.length - 1; intIndex > -1 ; intIndex--) 
	{
		//checks if the class name is the same as strClassName
		if(arrTAG[intIndex].className == strClassName && arrTAG[intIndex].id != tagActive.id)
			arrTAG[intIndex].src = strNonActiveImg;
		else if(arrTAG[intIndex].id == tagActive.id)
			arrTAG[intIndex].src = strActiveImg;
	}//end of for loop
}//end of classToggleLayerImg()

//removes from view all tags in tagContainer with the expection of tagActive and creates a link for the active and a label for the none 
//active also remove the old tag
//It assumes the tagActive and tagContiner already have the properties
function classToggleLayerTag(tagContainer,tagActive,strClassName,strTAGName,strName,strLink,strOnClick)
{
	var arrTAG = tagContainer.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	
	//goes around the for each tag that getElementsByTagName found in tagContainter
	for(var intIndex = arrTAG.length - 1; intIndex > -1; intIndex--)
	{		
		//checks if the class name is the same as strClassName and it is not active if it is active then change the dispaly to block
		if(arrTAG[intIndex].className == strClassName && arrTAG[intIndex].id != tagActive.id)
		{
			//remove the tag from arrTAG[intIndex}
			arrTAG[intIndex].removeChild(arrTAG[intIndex].childNodes[0]);
			
			//create link and for the nonActive
			createLink(tagContainer,strLink,strOnClick,strName,strClassName);
		}//end of if
		else if(arrTAG[intIndex].id == tagActive.id && tagActive.style.display == "")
			addNode(tagContainer.id,strName,false,true)
	}//end of for loop
}//end of classToggleLayerTag()

//sets up the basic inputs since they are so many of them for Textboxs and Hidden ONLY
function createInput(tagTD,strValue,strID,strNameTag,strReadOnly,intSize)
{
	var inpTag = document.createElement('input');//creates an element
	
	//sets the Attributes for the inpTag then adds it to the table
	inpTag.setAttribute('value', strValue);
	inpTag.setAttribute('id', strID);
	
	//checks if the Input is going to be hdden
	if (intSize != 0)
	{
		//sets the rest of the Textbox Attributes 
		//checks if strReadOnly is need
		if (strReadOnly != '')
		{
			//checks if the user is uing IE or another Browser
			if (navigator.userAgent.indexOf('MSIE') !=-1)
			{
				//checks to make sure that strReadOnly is 'true' meaing that it should be readonly
				if (strReadOnly == 'true')
					inpTag.setAttribute('readOnly', true);
			}//end of if
			else
				inpTag.setAttribute('readonly', strReadOnly);
		}//end of if
		
		inpTag.setAttribute('size', intSize);
		tagTD.appendChild(document.createTextNode(strNameTag));
	}//end of if
	else
		//sets the type for hidden
		inpTag.setAttribute('type', 'hidden');
		
	tagTD.appendChild(inpTag);
	
	return true;
}//end of createInput()

//sets up the basic Links since they are so many of them for Links ONLY
function createLink(tagTD,strLink,strOnClick,strNameTag,strClassName)
{
	//sets the Attributes for the tagA then adds it to the table
	tagA = document.createElement('a');//holds the Linking tag
	tagA.setAttribute('href',strLink);

	
	if (strClassName != null)
		tagA.setAttribute('class', strClassName);
		
	if (strOnClick != null)
		tagA.setAttribute('onclick',strOnClick);
	
	tagA.appendChild(document.createTextNode(strNameTag));
	tagTD.appendChild(tagA);
	
	return true;
}//end of createLink()

//sets up the basic TextArea since they are so many of them for TextArea ONLY
function createTextArea(tagTD,strValue,strID,boolDisable,intCols,intRows)
{
	var rtxtTag = document.createElement('textarea');//holds teh textarea tag
	
	//sets the Attributes for the rtxtTag then adds it to the table
	rtxtTag.value = strValue;
	rtxtTag.disabled = boolDisable;
	rtxtTag.id = strID;
	rtxtTag.cols = intCols;
	rtxtTag.rows = intRows;
	tagTD.appendChild(rtxtTag);
		
	return true
}//end of createTextArea()

//decodes str to be a normal string in order to read it
function decodeURL(strDecode)
{
     return unescape(strDecode.replace(/\+/g, " "));
}//end of decodeURL()

//does the display the a message in a on the page weather then an alert
function displayMessage(tagMessage,strMessText,boolAddToBack, boolRemoveNode)
{
	//gets the message properties and sets the text furthermore it does the display
	tagMessage = addNode(tagMessage,strMessText,boolAddToBack, boolRemoveNode);
	tagMessage.style.display = "block";	
	
	return tagMessage;
}//end of displayMessage()

//encodes str to a URL so it can be sent over the URL address
function encodeURL(strEncode)
{
	var strResult = "";
	
	for (intIndex = 0; intIndex < strEncode.length; intIndex++)
	{
		if (strEncode.charAt(intIndex) == " ") strResult += "+";
		else strResult += strEncode.charAt(intIndex);
	}//end of for loop
	
	return escape(strResult);
}//end of encodeURL()

//gives the user the message has been sent or not and changes the pop area
function endMessage(strEndMessage,strID,tagMessage,tagGrayOut,tagEMailBody)
{
	var tagPopUpArea = getDocID(strID);//holds the pop up area
	//var arrActullyEndMassage = strEndMessage.split("</head>");//gets the acrtully end message because ASP.NET has alot of useless overhead
	
	//adds some text to the div tag and then displays it to the user
	displayMessage(tagMessage,strEndMessage,true,true);
	
	//adds in the new line
	//tagPopUpArea.appendChild(document.createElement('br'));
	
	//checks if there is the finction was called by the Contact form which does not have a CSS Pop-Up Window
	if (strID != "")
	{
		var tagDIV = document.createElement('div');//holds the DIV tag
		
		//holds the real time div and give its name and align and the link that will close the pop up
		tagDIV.setAttribute('id', "divClose" + strID);
		tagDIV.setAttribute('align', "center");
		//tagPopUpArea.appendChild(tagDIV);
	}//end of if
}//end of endMessage()

//gets the document properties in order to use them as there are many types of browers with different versions
function getDocID(tagLayer)
{
	var tagProp = "";//holds the proerties of tagLayer

	//gets the whichLayer Properties depending of the differnt bowers the user is using
	if (document.getElementById)//this is the way the standards work
		tagProp = document.getElementById(tagLayer);
	else if (document.all)//this is the way old msie versions work
		tagProp = document.all[tagLayer];
	else if (document.layers)//this is the way nn4 works
		tagProp = document.layers[tagLayer];
		
	return tagProp;
}//end of getDocID()

//gets the document properties in order to use them as there are many types of browers with different versions by the Name
function getDocName(tagLayer)
{
	var tagProp = "";//holds the proerties of tagLayer

	tagProp = document.getElementsByName(tagLayer);
		
	return tagProp;
}//end of getDocName()

//does a group tigger that hides or displays tags
function groupToggleLayer(tagUpperPrice,tagRecommend,tagLine,boolIsShowing)
{
	//gets the properties
	tagUpperPrice = getDocID(tagUpperPrice);
	tagRecommend = getDocID(tagRecommend);
	tagLine = getDocID(tagLine);
	
	if (tagUpperPrice != null && boolIsShowing == false)
		tagUpperPrice.style.display = "none";
	else if(tagUpperPrice != null && boolIsShowing == true)
		tagUpperPrice.style.display = "";
		
	if (tagRecommend != null && boolIsShowing == false)
		tagRecommend.style.display = "none";
	else if(tagRecommend != null && boolIsShowing == true)
		tagRecommend.style.display = "";
		
	if (tagLine != null && boolIsShowing == false)
		tagLine.style.display = "none";
	else if(tagLine != null && boolIsShowing == true)
		tagLine.style.display = "";    
}//end of groupToggleLayer()

//Changes the layers of the information section of item detail
function infoDetailLayer(whichLayer,layer1,layer2,layer3)
{
	var activeLayer = "";//holds the active Layer	
	var style2 = "";//holds the style of layer1
	var style3 = "";//holds the style of layer2
	var style4 = "";//holds the style of layer3

	// this is the way the standards work
	if (whichLayer != ''){activeLayer = getDocID(whichLayer);}
	if (layer1 != ''){style2 = getDocID(layer1);}
	if (layer2 != ''){style3 = getDocID(layer2);}
	if (layer3 != ''){style4 = getDocID(layer3);}

	//Checks if there is an active layer
	if (activeLayer != "" && activeLayer != null)
	{
		//checks if the activeLayer is already active and if so then skips code
		//since the layer cannot be turn off and leave a hole in the review layer
		if (activeLayer.style.display == "")
		{
			//removes the block from the display in order to make the layer to disapper	
			if (style2 != '')
				style2.style.display = style2.style.display? "":"";

			//checks if there is a style3
			if (style3 != '')
				style3.style.display = style3.style.display? "":"";
				
			//checks if there is a style3
			if (style4 != '')
				style4.style.display = style4.style.display? "":"";
	
			//displays the new active Layer and updates its id
			activeLayer.style.display = activeLayer.style.display? "":"block";
		}//end of if
	}//end of if
}//end of infoDetailLayer()

//removes all new lines and replaces them with a <br/> html tag
function nl2br(strText)
{
	//checks if there is anything inside strText
	if (strText != "")
	{
 		var re_nlchar = "";//holds the different newlines that the OS uses
		strText = escape(strText);//in codes strText to be more like a URL to find the newlines
			
		//finds the either \r or \n or both since \r is for Linex and Apple and \n is for MS
		if(strText.indexOf('%0D%0A') > -1)
			re_nlchar = /%0D%0A/g ;
		else if(strText.indexOf('%0A') > -1)
			re_nlchar = /%0A/g ;
		else if(strText.indexOf('%0D') > -1)
			re_nlchar = /%0D/g ;
	
		//checks if there is any new lines in strText
		if (re_nlchar != "")
			//changes the strText back to normal with all of the newlines changes to <br/> tag
			return unescape(strText.replace(re_nlchar,'<br />'));
	}//end of if
	
	return strText;
}//end of nl2br()

//set up the form to not be used while sending the message
function preSendToServer(tagMessage,tagLightBoxBody,strMessage)
{
	//display to the user their message is beening sent and disables the textbox area
	tagMessage.innerHTML = strMessage;
	tagLightBoxBody.style.display = 'none';
}//end of preSendToServer()

//rejects 2 tags to mach one another hieght wiase
function rejustHeight(tagCotentHolder,tagActionLinkHolder)
{
	//check if action already has a hieght and if so then removes it
	if(getDocID(tagActionLinkHolder).style.height != "") 
		getDocID(tagActionLinkHolder).style.height = "";
	
	//checks if tagContentHolder the one with all of the content of the Product is
	//longer then the action link holder and if so then do the funciton
	//to make them equal
	if(getDocID(tagCotentHolder).offsetHeight > 716)
		//makes sure that both the div for the action and the div for the content are equal
		P7_equalCols2(0,tagCotentHolder,'label',tagActionLinkHolder,'div');
	else
		//floors the height to a min amount
		getDocID(tagActionLinkHolder).style.height = "716px";
}//end of rejustHeight()

//dyamiclly change Lightbox Content
function reloadLightBoxBody(strLightBoxBody,strLightBoxTitle,tagLightBoxBody,tagLightBoxTitle,strFileName,strTableName,strFieldNameID,strID,strReturnFieldName)
{
	var htmlJavaServerObject = getXMLHttpRequest();//holds the object of the server

	//gets the proeprties of the tags	
    tagLightBoxBody = getDocID(tagLightBoxBody);
	tagLightBoxTitle = getDocID(tagLightBoxTitle);
	
    if(tagLightBoxBody != null)
	    tagLightBoxBody.innerHTML = strLightBoxBody + "<div align=\"center\"><label class=\"lblFontColorRed\">Loading Data...</label></div>";
	
	if(tagLightBoxTitle != null)
	    tagLightBoxTitle.innerHTML = strLightBoxTitle;
				
	//Abort any currently active request.
	htmlJavaServerObject.abort();
	
	// Makes a request
 	htmlJavaServerObject.open("Post", strFileName, true);
	htmlJavaServerObject.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	htmlJavaServerObject.onreadystatechange = function(){
    	if(htmlJavaServerObject.readyState == 4 && htmlJavaServerObject.status == 200)
		{
			if(tagLightBoxBody != null)
			{
				//remoces the Loading text from tagLightBoxBody
				//for IE 
				if (navigator.userAgent.indexOf('MSIE') != -1)
					tagLightBoxBody.innerHTML = tagLightBoxBody.innerHTML.replace("<DIV align=center><LABEL class=lblFontColorRed>Loading Data...</LABEL></DIV>", "");
				else
					tagLightBoxBody.innerHTML = tagLightBoxBody.innerHTML.replace("<div align=\"center\"><label class=\"lblFontColorRed\">Loading Data...</label></div>", "");
				
				//adds the data from the database to the page
				tagLightBoxBody.innerHTML += htmlJavaServerObject.responseText;
			}//end of if
		}//end of if
		else if(htmlJavaServerObject.readyState == 2 && htmlJavaServerObject.status == 500)
		{
			//closes the pop up and removes the textbox so the user cannot use them again until they refresh the page
			if(tagLightBoxBody != null)
			{
				//remoces the Loading text from tagLightBoxBody
				//for IE 
				if (navigator.userAgent.indexOf('MSIE') != -1)
					tagLightBoxBody.innerHTML = tagLightBoxBody.innerHTML.replace("<DIV align=center><LABEL class=lblFontColorRed>Loading Data...</LABEL></DIV>", "");
				else
					tagLightBoxBody.innerHTML = tagLightBoxBody.innerHTML.replace("<div align=\"center\"><label class=\"lblFontColorRed\">Loading Data...</label></div>", "");

				//tells the user that there is a problem
				tagLightBoxBody.innerHTML += '<label>Unable to Connect to the Server.<label>';
			}//end of if
		}//end of else if
	}//end of function()
	
	htmlJavaServerObject.send("tableName=" + encodeURL(strTableName) + "&fieldNameID=" + encodeURL(strFieldNameID) + "&returnFieldName=" + encodeURL(strReturnFieldName) + "&ID=" + encodeURL(strID));
	
	return true;
}//end of reloadLightBoxBody()

//removes all contorls from tagContent
function removeAll(tagContent)
{
	tagContent = getDocID(tagContent);//holds the Content that 
		
	if (tagContent != null)
	{		
		for(var intIndex = 0; intIndex < tagContent.childNodes.length; intIndex++)
		{
			tagContent.removeChild(tagContent.childNodes[intIndex]);
		}//end of for loop
	}//end of if	
}//end of removeAll()

//removes content from a LightBox
function removeLightBoxBody(tagLightBoxBodyFile)
{	
	if(tagLightBoxBodyFile == null)
		tagLightBoxBodyFile = "divLightBoxBody";

    var tagLightBoxBodyFile = getDocID(tagLightBoxBodyFile);
	
    if(tagLightBoxBodyFile != null)	
	    tagLightBoxBodyFile.innerHTML = '';
}//end of removeLightBoxBody()

//sends an email to for the newsleter sign up
function sendNewsletter(strFileName,tagGrayOut,tagErrorMessage,tagThankYouMessage,tagLightBoxBody,tagFirstName,tagLastName,tagEmail,lblFirstName,lblLastName,lblEmail)
{
	var strFilter = /^.+@.+\..{2,3}$/;//holds the filtter for the Email
	var htmlJavaServerObject = getXMLHttpRequest();//holds the object of the server
	var boolErrors = false;//holds the check if there is an error on the form

	//checks if they have a First Name
	if (tagFirstName.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblFirstName.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if they have a last name
	if (tagLastName.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblLastName.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
					
	//checks if there is E-Mail
	if (tagEmail.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblEmail.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there the E-Mail Format is current
	if (tagEmail.value != "" && strFilter.test(tagEmail.value) == false)
  	{
		displayMessage(tagErrorMessage,'Error! Please input valid e-mail address',true,true);
		lblEmail.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	else if (tagEmail.value != "" && tagEmail.value.match(/[\(\)\<\>\,\;\:\\\/\"\[\]]/))
  	{
		displayMessage(tagErrorMessage,'Error! Your e-mail address contains illegal characters.',true,true);
		lblEmail.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is any errors in the form
	if(boolErrors == true)
		return false;
	
	//Abort any currently active request.
	htmlJavaServerObject.abort();
	
	//prepers the form for sending
	preSendToServer(tagThankYouMessage,tagLightBoxBody,'Sending Data...');
	
	//Makes a request
 	htmlJavaServerObject.open("Post", strFileName, true);
	htmlJavaServerObject.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	htmlJavaServerObject.onreadystatechange = function(){
    	if(htmlJavaServerObject.readyState == 4 && htmlJavaServerObject.status == 200)
		{
			//resets the fields and disables the field area
            tagFirstName.value = "";
			tagLastName.value = "";
			tagEmail.value = "";
			
			//means dispapire
			tagThankYouMessage.innerHTML = "<label><strong>Thank you for signing up!</strong><br/><br/>You are now a subscriber to Daily Bread Food Bank's e-newsletter, Newsbytes. You will receive e-alerts when Daily Bread has news to report.</label>";
		}//end of if
		else if(htmlJavaServerObject.readyState == 2 && htmlJavaServerObject.status == 500)
		{
			//closes the pop up and removes the textbox so the user cannot use them again until they refresh the page
			endMessage('Unable to Connect to the Server.','',tagThankYouMessage,tagGrayOut,tagLightBoxBody);
		}//end of else if
	}//end of function()
	
	htmlJavaServerObject.send("txtFName=" + encodeURL(tagFirstName.value) + "&txtLName=" + encodeURL(tagLastName.value) + "&txtEmail=" + encodeURL(nl2br(tagEmail.value)));

	return true;
}//end of sendNewsletter()


//sends an email to for the Pickup form
function sendPickup(strFileName,tagGrayOut,tagErrorMessage,tagThankYouMessage,tagLightBoxBody,tagorganization2,tagcontactperson2,tagemail2,tagtelephone2,tagaddress2,tagcity2,tagprovince2,tagpostalcode2,tagintersection2,tagalternatecontact2,tagcontactemail2,tagphone2,tagext2,tagalt12,tagalt22,tagspecialinstructions2,tagpickupdate2,tagpickupaddress2,taghowmuchfood2,lblorganization2,lblcontactperson2,lblemail2,lbltelephone2,lbladdress2,lblcity2,lblprovince2,lblpostalcode2,lblintersection2,lblalternatecontact2,lblcontactemail2,lblphone2,lblext2,lblalt12,lblalt22,lblspecialinstructions2,lblpickupdate2,lblpickupaddress2,lblhowmuchfood2)
{
	var strFilter = /^.+@.+\..{2,3}$/;//holds the filtter for the Email
	var htmlJavaServerObject = getXMLHttpRequest();//holds the object of the server
	var boolErrors = false;//holds the check if there is an error on the form

	//checks if they have a organization
	if (tagorganization2.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblorganization2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if they have a last name
	if (tagcontactperson2.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblcontactperson2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
					
	
	
	//checks if there the E-Mail Format is current
	if (tagemail2.value != "" && strFilter.test(tagemail2.value) == false)
  	{
		displayMessage(tagErrorMessage,'Error! Please input valid e-mail address',true,true);
		lblemail2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	else if (tagemail2.value != "" && tagemail2.value.match(/[\(\)\<\>\,\;\:\\\/\"\[\]]/))
  	{
		displayMessage(tagErrorMessage,'Error! Your e-mail address contains illegal characters.',true,true);
		lblemail2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	
	//checks if there is E-Mail
	if (tagemail2.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblemail2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	//checks if there is E-Mail
	if (tagtelephone2.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbltelephone2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	//checks if there is E-Mail
	if (tagaddress2.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbladdress2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is E-Mail
	if (tagcity2.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblcity2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	//checks if there is E-Mail
	if (tagprovince2.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblprovince2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is E-Mail
	if (tagpostalcode2.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblpostalcode2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	//checks if there is E-Mail
	if (tagintersection2.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblintersection2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	//checks if there is E-Mail
	if (tagpickupdate2.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblpickupdate2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is E-Mail
	if (tagpickupaddress2.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblpickupaddress2.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is any errors in the form
	if(boolErrors == true)
		return false;
	
	//Abort any currently active request.
	htmlJavaServerObject.abort();
	
	//prepers the form for sending
	preSendToServer(tagThankYouMessage,tagLightBoxBody,'Sending Data...');
	
	//Makes a request
 	htmlJavaServerObject.open("Post", strFileName, true);
	htmlJavaServerObject.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	htmlJavaServerObject.onreadystatechange = function(){
    	if(htmlJavaServerObject.readyState == 4 && htmlJavaServerObject.status == 200)
		{
			//resets the fields and disables the field area
            tagorganization2.value = "";
			tagcontactperson2.value = "";
			tagemail2.value = "";
			tagtelephone2.value = "";
			tagaddress2.value = "";
			tagcity2.value = "";
			tagprovince2.value = "";
			tagpostalcode2.value = "";
			tagintersection2.value = "";
			tagalternatecontact2.value = "";
			tagcontactemail2.value = "";
			tagphone2.value = "";
			tagext2.value = "";
			tagalt12.value = "";
			tagalt22.value = "";
			tagspecialinstructions2.value = "";
			tagpickupdate2.value = "";
			tagpickupaddress2.value = "";
			taghowmuchfood2.value = "";
			
			//means dispapire
			tagThankYouMessage.innerHTML = "<label>Thank you for submitting your Food Drive Pick Up request. We will be in touch soon to coordinate a pick up date.</label>";
		}//end of if
		else if(htmlJavaServerObject.readyState == 2 && htmlJavaServerObject.status == 500)
		{
			//closes the pop up and removes the textbox so the user cannot use them again until they refresh the page
			endMessage('Unable to Connect to the Server.','',tagThankYouMessage,tagGrayOut,tagLightBoxBody);
		}//end of else if
	}//end of function()
	
	htmlJavaServerObject.send("txtorganization2=" + encodeURL(tagorganization2.value) + "&txtcontactperson2=" + encodeURL(tagcontactperson2.value) + "&txtemail2=" + encodeURL(nl2br(tagemail2.value)) + "&txttelephone2=" + encodeURL(tagtelephone2.value) + "&txtaddress2=" + encodeURL(tagaddress2.value) + "&txtcity2=" + encodeURL(tagcity2.value) + "&txtprovince2=" + encodeURL(tagprovince2.value) + "&txtpostalcode2=" + encodeURL(tagpostalcode2.value) + "&txtintersection2=" + encodeURL(tagintersection2.value) + "&txtalternatecontact2=" + encodeURL(tagalternatecontact2.value) + "&txtcontactemail2=" + encodeURL(tagcontactemail2.value) + "&txtphone2=" + encodeURL(tagphone2.value) + "&txtext2=" + encodeURL(tagext2.value) + "&txtalt12=" + encodeURL(tagalt12.value) + "&txtalt22=" + encodeURL(tagalt22.value) + "&txtspecialinstructions2=" + encodeURL(tagspecialinstructions2.value) + "&txtpickupdate2=" + encodeURL(tagpickupdate2.value) + "&txtpickupaddress2=" + encodeURL(tagpickupaddress2.value) + "&txthowmuchfood2=" + encodeURL(taghowmuchfood2.value));

	return true;
}//end of sendPickup()

//sends an email to for the Tally form
function sendTally(strFileName,tagGrayOut,tagErrorMessage,tagThankYouMessage,tagLightBoxBody,tagorganization3,tagcontactperson3,tagemail3,tagtelephone3,tagfax3,tagaddress3,tagcity3,tagprovince3,tagpostalcode3,tagstartdate3,tagenddate3,tagdescription3,tagorganizedby3,tagwhatcollected3,tagfoodpounds3,tagdropoffat3,lblorganization3,lblcontactperson3,lblemail3,lbltelephone3,lblfax3,lbladdress3,lblcity3,lblprovince3,lblpostalcode3,lblstartdate3,lblenddate3,lbldescription3,lblorganizedby3,lblwhatcollected3,lblfoodpounds3,lbldropoffat3)
{
	var strFilter = /^.+@.+\..{2,3}$/;//holds the filtter for the Email
	var htmlJavaServerObject = getXMLHttpRequest();//holds the object of the server
	var boolErrors = false;//holds the check if there is an error on the form
	var intorganizedby3 = validateRadio(tagorganizedby3);
	var intwhatcollected3 = validateRadio(tagwhatcollected3);

	//checks if they have a organization
	if (tagorganization3.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblorganization3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if they have a last name
	if (tagcontactperson3.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblcontactperson3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
					
	
	//checks if there the E-Mail Format is current
	if (tagemail3.value != "" && strFilter.test(tagemail3.value) == false)
  	{
		displayMessage(tagErrorMessage,'Error! Please input valid e-mail address',true,true);
		lblemail3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	else if (tagemail3.value != "" && tagemail3.value.match(/[\(\)\<\>\,\;\:\\\/\"\[\]]/))
  	{
		displayMessage(tagErrorMessage,'Error! Your e-mail address contains illegal characters.',true,true);
		lblemail3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
		//checks if there is E-Mail
	if (tagemail3.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblemail3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
		//checks if there is E-Mail
	if (tagtelephone3.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbltelephone3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	//checks if there is E-Mail
	if (tagaddress3.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbladdress3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is E-Mail
	if (tagcity3.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblcity3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	//checks if there is E-Mail
	if (tagprovince3.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblprovince3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is E-Mail
	if (tagpostalcode3.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblpostalcode3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	
		//checks if there is E-Mail
	if (tagstartdate3.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblstartdate3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
		
	
		//checks if there is E-Mail
	if (tagenddate3.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblenddate3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	
	
		//checks if there is E-Mail
	if (tagwhatcollected3.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblwhatcollected3.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
		
	
	//checks if there is any errors in the form
	if(boolErrors == true)
		return false;
	
	//Abort any currently active request.
	htmlJavaServerObject.abort();
	
	//prepers the form for sending
	preSendToServer(tagThankYouMessage,tagLightBoxBody,'Sending Data...');
	
	//Makes a request
 	htmlJavaServerObject.open("Post", strFileName, true);
	htmlJavaServerObject.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	htmlJavaServerObject.onreadystatechange = function(){
    	if(htmlJavaServerObject.readyState == 4 && htmlJavaServerObject.status == 200)
		{
			//resets the fields and disables the field area
            tagorganization3.value = "";
			tagcontactperson3.value = "";
			tagemail3.value = "";
			tagtelephone3.value = "";
			tagfax3.value = "";
			tagaddress3.value = "";
			tagcity3.value = "";
			tagprovince3.value = "";
			tagpostalcode3.value = "";
			tagstartdate3.value = "";
			tagenddate3.value = "";
			tagdescription3.value = "";
			tagorganizedby3.value = "";
			tagwhatcollected3.value = "";
			tagfoodpounds3.value = "";
			tagdropoffat3.value = "";

			//means dispapire
			//tagThankYouMessage.innerHTML = "";
			
					
			
			if(tagorganizedby3[intorganizedby3].value == "company")
  	{
				//means dispapire
			tagThankYouMessage.innerHTML = "<label>Thank you very much for your interest in running a food or fund drive for Daily Bread. Running a food or fund drive is fun and easy. You are supporting an important cause!</label><br /><br /><label><strong>Tips to help make your drive a successful one:</strong> <ul><li>Communicate the drive by sending out weekly announcements with updates.</li><li><a href='../PDFS/01_Donate/01_PDF3_DBFB-DonationPoster.pdf' target='_blank'>Download a poster</a> or make your own poster. Place posters in highly visible areas and on collection bins. </li><li>Set up an area where people can drop off their food, such as the main office, lobby or a highly visible area. </li><li>Motivate staff or community members by having friendly competitions between departments or floors. Give prizes like free lunch or bragging rights to teams/individuals that bring in the most food/funds.</li><li>Have a themed food drive by focusing on one or a couple of items on our most needed items list, such as a tuna drive, bean drive or a pasta drive. </li></ul></label><br><label><strong>Most needed items:</strong><ul><li>Baby formula &amp; Food</li><li>Beans &amp; lentils</li><li>Canned fruit &amp; vegetables</li><li>Canned fish &amp; meat</li><li>Cans of soup or hearty stew</li><li>Dried pasta &amp; tomato sauce	</li><li>Macaroni &amp; cheese	</li><li>Peanut butter </li><li>Rice </li><li>Tetra Pak, canned or powdered milk</li></ul></label><br><label><strong>Getting the food to us:</strong><ul><li>Use printer paper boxes or one of our bins to hold food in. </li><li>If you plan on collecting over 300lbs or more (that's 30 grocery bags or 10 printer paper boxes) Daily Bread can deliver a 2x2 and 4ft in height bin to help you store donations. <strong>Please call or email to request to use these bins. </strong></li><li>At the end of your drive, you can drop off your donations at an on-going drop off location, <a href='../PDFS/01_Donate/01_PDF2_on-going-Food-Drop-Off-Locations-II.pdf' target='_blank'>click here</a> for list.  </li><li>If you are not able to drop off donations, please fill out the food drive pick up form or call us at 416-203-0050. We can schedule a pick up between 11am and 3pm, Mon-Fri. </li></ul></label><br> <strong>Online challenge:</strong><br>Fundraise online during any of our three annual drives -  Spring, Fall and Holiday. Our efficient online challenge will allow you to sign up your company team with a logo and create a target. Your supporters will receive an automatic emailed tax receipt for donations over $10. Most importantly, you will be helping us purchase food, get it to those that need it most, and continue our work in advocacy and research! I would be more than happy to help you sign up your team or answer any questions you might have.";
	}
	else if(tagorganizedby3[intorganizedby3].value == "school")
	{
			//means dispapire
			tagThankYouMessage.innerHTML = "<label>Thank you very much for your interest in running a food or fund drive for Daily Bread. Running a food or fund drive is fun and easy. You are supporting an important cause!</label><br /><br /><label><strong>Tips to help make your drive a successful one:</strong> <ul><li>Communicate the drive to all students by sending out weekly announcements with upds. </li><li><a href='../PDFS/01_Donate/01_PDF3_DBFB-DonationPoster.pdf' target='_blank'>Download a poster</a> or make your own poster. Place posters in highly visible areas and on collection bins.</li><li>Set up an area where people can drop off their food, such as the main office, lobby or a highly visible area. </li><li>Motivate students by having friendly competitions between classes. Give prizes like free lunch or bragging rights to teams/students that bring in the most food/funds. </li><li>Have a themed food drive by focusing on one or a couple of items on our most needed items list, such as a tuna drive, bean drive or pasta drive. </li></ul></label><br><label><strong>Most needed items:</strong><ul><li>Baby formula &amp; Food</li><li>Beans &amp; lentils</li><li>Canned fruit &amp; vegetables</li><li>Canned fish &amp; meat</li><li>Cans of soup or hearty stew</li><li>Dried pasta &amp; tomato sauce	</li><li>Macaroni &amp; cheese	</li><li>Peanut butter </li><li>Rice </li><li>Tetra Pak, canned or powdered milk</li></ul></label><br><label><strong>Getting the food to us:</strong><ul><li>Use printer paper boxes or one of our bins to hold food in. </li><li>If you plan on collecting over 300lbs or more (that's 30 grocery bags or 10 printer paper boxes) Daily Bread can deliver a 2x2 and 4ft in height bin to help you store donations. <strong>Please call or email to request to use these bins. </strong></li><li>At the end of your drive, you can drop off your donations at an on-going drop off location, <a href='../PDFS/01_Donate/01_PDF2_on-going-Food-Drop-Off-Locations-II.pdf' target='_blank'>click here</a> for list.  </li><li>If you are not able to drop off donations, please fill out the food drive pick up form or call us at 416-203-0050. We can schedule a pick up between 11am and 3pm, Mon-Fri. </li></ul></label><br><label><em>Lastly, Hungry City: Make Your Mark</em>, is a Daily Bread Food Bank educational initiative that gives today's youth and educators the opportunity to take action and be part of the fight against hunger in the GTA. Check out <a href='http://www.hungrycity.ca' target='_blank'><strong>www.hungrycity.ca</strong></a> for information and tools that can help you with your upcoming food drive or contact our Public Education Coordinator.";
	}
			
			
			//means dispapire
			tagThankYouMessage.innerHTML += "<br><br>Thanks again for your support in helping to fight hunger in our communities! Please do not hesitate to contact me directly if you require any further assistance.<br><br>Warm Regards,<br><br>Joelle Efford-Gibbons<br>joelle@dailybread.ca<br>416-203-0050 x225</label>";
			
			
			
			//means dispapire
			/*tagThankYouMessage.innerHTML = "<label><strong>Thank you for signing up!</strong><br/><br/>You are now a subscriber to Daily Bread Food Bank's e-newsletter, Newsbytes. You will receive e-alerts when Daily Bread has news to report.</label>";*/
		}//end of if
		else if(htmlJavaServerObject.readyState == 2 && htmlJavaServerObject.status == 500)
		{
			//closes the pop up and removes the textbox so the user cannot use them again until they refresh the page
			endMessage('Unable to Connect to the Server.','',tagThankYouMessage.id,tagGrayOut,tagLightBoxBody);
		}//end of else if
	}//end of function()
	
	htmlJavaServerObject.send("txtorganization3=" + encodeURL(tagorganization3.value) + "&txtcontactperson3=" + encodeURL(tagcontactperson3.value) + "&txtemail3=" + encodeURL(nl2br(tagemail3.value)) + "&txttelephone3=" + encodeURL(tagtelephone3.value) + "&txtfax3=" + encodeURL(tagfax3.value) + "&txtaddress3=" + encodeURL(tagaddress3.value) + "&txtcity3=" + encodeURL(tagcity3.value) + "&txtprovince3=" + encodeURL(nl2br(tagprovince3.value)) + "&txtpostalcode3=" + encodeURL(tagpostalcode3.value) + "&txtstartdate3=" + encodeURL(tagstartdate3.value) + "&txtenddate3=" + encodeURL(tagenddate3.value) + "&txtdescription3=" + encodeURL(tagdescription3.value) + "&txtorganizedby3=" + encodeURL(tagorganizedby3[intorganizedby3].value) + "&txtwhatcollected3=" + encodeURL(tagwhatcollected3[intwhatcollected3].value) + "&txtfoodpounds3=" + encodeURL(tagfoodpounds3.value) + "&txtdropoffat3=" + encodeURL(nl2br(tagdropoffat3.value)));

	return true;
}//end of sendTally()

//sends an email to for the Volunteer form
function sendVol(strFileName,tagGrayOut,tagErrorMessage,tagThankYouMessage,tagLightBoxBody,tagfname4,taglname4,tagaddress4,tagcity4,tagprovince4,tagpostalcode4,tagtelephone4,tagemail4,tagletter4,taginterest4,lblfname4,lbllname4,lbladdress4,lblcity4,lblprovince4,lblpostalcode4,lbltelephone4,lblemail4,lblletter4,lblinterest4)
{
	var strFilter = /^.+@.+\..{2,3}$/;//holds the filtter for the Email
	var htmlJavaServerObject = getXMLHttpRequest();//holds the object of the server
	var boolErrors = false;//holds the check if there is an error on the form
	
	var intletter4 = validateRadio(tagletter4);
	var intinterest4 = validateRadio(taginterest4);

	//checks if they have a organization
	if (tagfname4.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblfname4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if they have a last name
	if (taglname4.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbllname4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
					
	
		
	//checks if there is E-Mail
	if (tagaddress4.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbladdress4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is E-Mail
	if (tagcity4.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblcity4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	//checks if there is E-Mail
	if (tagprovince4.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblprovince4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is E-Mail
	if (tagpostalcode4.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblpostalcode4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
		//checks if there is E-Mail
	if (tagtelephone4.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbltelephone4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
		//checks if there is E-Mail
	if (tagemail4.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblemail4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	//checks if there is E-Mail
	if (tagemail4.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblemail4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there the E-Mail Format is current
	if (tagemail4.value != "" && strFilter.test(tagemail4.value) == false)
  	{
		displayMessage(tagErrorMessage,'Error! Please input valid e-mail address',true,true);
		lblemail4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	else if (tagemail4.value != "" && tagemail4.value.match(/[\(\)\<\>\,\;\:\\\/\"\[\]]/))
  	{
		displayMessage(tagErrorMessage,'Error! Your e-mail address contains illegal characters.',true,true);
		lblemail4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
			
	/*
		//checks if there is E-Mail
	if (tagletter4.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblletter4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	
	
		//checks if there is E-Mail
	if (taginterest4.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblinterest4.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	*/
		
	
	//checks if there is any errors in the form
	if(boolErrors == true)
		return false;
	
	//Abort any currently active request.
	htmlJavaServerObject.abort();
	
	//prepers the form for sending
	preSendToServer(tagThankYouMessage,tagLightBoxBody,'Sending Data...');
	
	//Makes a request
 	htmlJavaServerObject.open("Post", strFileName, true);
	htmlJavaServerObject.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	htmlJavaServerObject.onreadystatechange = function(){
    	if(htmlJavaServerObject.readyState == 4 && htmlJavaServerObject.status == 200)
		{
			//resets the fields and disables the field area
            tagfname4.value = "";
			taglname4.value = "";
			tagaddress4.value = "";
			tagcity4.value = "";
			tagprovince4.value = "";
			tagpostalcode4.value = "";
			tagtelephone4.value = "";
			tagemail4.value = "";
			tagletter4.value = "";
			taginterest4.value = "";
			
			//means dispapire
			tagThankYouMessage.innerHTML = "<label>Thanks for your interest in volunteering at Daily Bread Food Bank. A staff member will be in touch soon to discuss your area of interest.</label>";
		}//end of if
		else if(htmlJavaServerObject.readyState == 2 && htmlJavaServerObject.status == 500)
		{
			//closes the pop up and removes the textbox so the user cannot use them again until they refresh the page
			endMessage('Unable to Connect to the Server.','',tagThankYouMessage,tagGrayOut,tagLightBoxBody);
		}//end of else if
	}//end of function()
	
	htmlJavaServerObject.send("txtfname4=" + encodeURL(tagfname4.value) + "&txtlname4=" + encodeURL(taglname4.value) + "&txtaddress4=" + encodeURL(tagaddress4.value) + "&txtcity4=" + encodeURL(tagcity4.value) + "&txtprovince4=" + encodeURL(tagprovince4.value) + "&txtpostalcode4=" + encodeURL(tagpostalcode4.value) + "&txttelephone4=" + encodeURL(tagtelephone4.value) + "&txtemail4=" + encodeURL(nl2br(tagemail4.value)) + "&txtletter4=" + encodeURL(tagletter4[intletter4].value) + "&txtinterest4=" + encodeURL(taginterest4[intinterest4].value));

	return true;
}//end of sendVol()

//sends an email to for the Reg form
function sendReg(strFileName,tagGrayOut,tagErrorMessage,tagThankYouMessage,tagLightBoxBody,tagorganization5,tagcontactperson5,tagemail5,tagtelephone5,tagfax5,tagaddress5,tagcity5,tagprovince5,tagpostalcode5,tagstartdate5,tagparnum5,tagenddate5,tagdescription5,tagorganizedby5,tagwhatcollected5,taggoalpounds5,taggoaldollars5,tagmatching5,tagspecifics5,lblorganization5,lblcontactperson5,lblemail5,lbltelephone5,lblfax5,lbladdress5,lblcity5,lblprovince5,lblpostalcode5,lblstartdate5,lblparnum5,lblenddate5,lbldescription5,lblorganizedby5,lblwhatcollected5,lblgoalpounds5,lblgoaldollars5,lblmatching5,lblspecifics5)
{
	var strFilter = /^.+@.+\..{2,3}$/;//holds the filtter for the Email
	var htmlJavaServerObject = getXMLHttpRequest();//holds the object of the server
	var boolErrors = false;//holds the check if there is an error on the form

var intorganizedby5 = validateRadio(tagorganizedby5);
var intwhatcollected5 = validateRadio(tagwhatcollected5);
var intmatching5 = validateRadio(tagmatching5);

	//checks if they have a organization
	if (tagorganization5.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblorganization5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if they have a last name
	if (tagcontactperson5.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblcontactperson5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
					
	
	//checks if there the E-Mail Format is current
	if (tagemail5.value != "" && strFilter.test(tagemail5.value) == false)
  	{
		displayMessage(tagErrorMessage,'Error! Please input valid e-mail address',true,true);
		lblemail5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	else if (tagemail5.value != "" && tagemail5.value.match(/[\(\)\<\>\,\;\:\\\/\"\[\]]/))
  	{
		displayMessage(tagErrorMessage,'Error! Your e-mail address contains illegal characters.',true,true);
		lblemail5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
		//checks if there is E-Mail
	if (tagemail5.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblemail5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
		//checks if there is E-Mail
	if (tagtelephone5.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbltelephone5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	//checks if there is E-Mail
	if (tagaddress5.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbladdress5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is E-Mail
	if (tagcity5.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblcity5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	//checks if there is E-Mail
	if (tagprovince5.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblprovince5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is E-Mail
	if (tagpostalcode5.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblpostalcode5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	
		//checks if there is E-Mail
	if (tagstartdate5.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblstartdate5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
		
	
		//checks if there is E-Mail
	if (tagenddate5.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblenddate5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
		
		//checks if there is E-Mail
	if (tagdescription5.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbldescription5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
		
	
		//checks if there is E-Mail
	if (tagwhatcollected5.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblwhatcollected5.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	
	//checks if there is any errors in the form
	if(boolErrors == true)
		return false;
	
	//Abort any currently active request.
	htmlJavaServerObject.abort();
	
	//prepers the form for sending
	preSendToServer(tagThankYouMessage,tagLightBoxBody,'Sending Data...');
	
	//Makes a request
 	htmlJavaServerObject.open("Post", strFileName, true);
	htmlJavaServerObject.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	htmlJavaServerObject.onreadystatechange = function(){
    	if(htmlJavaServerObject.readyState == 4 && htmlJavaServerObject.status == 200)
		{
			//resets the fields and disables the field area
            tagorganization5.value = "";
			tagcontactperson5.value = "";
			tagemail5.value = "";
			tagtelephone5.value = "";
			tagfax5.value = "";
			tagaddress5.value = "";
			tagcity5.value = "";
			tagprovince5.value = "";
			tagpostalcode5.value = "";
			tagstartdate5.value = "";
			tagparnum5.value = "";
			tagenddate5.value = "";
			tagdescription5.value = "";
			tagorganizedby5.value = "";
			tagwhatcollected5.value = "";
			taggoalpounds5.value = "";
			taggoaldollars5.value = "";
			tagmatching5.value = "";
			tagspecifics5.value = "";

			
			
			//means dispapire
			tagThankYouMessage.innerHTML = "<label>Thank you very much for your interest in running a food or fund drive for Daily Bread. Running a food or fund drive is fun and easy. You are supporting an important cause!</label><br /><br /><label><strong>Tips to help make your drive a successful one:</strong> <ul>  <li>Communicate the drive to all students by sending out weekly announcements with upds.  </li>  <li><a href='../PDFS/01_Donate/01_PDF3_DBFB-DonationPoster.pdf' target='_blank'>Download a poster</a> or make your own poster. Place posters in highly visible areas and on collection bins.    </li>  <li>Set up an area where people can drop off their food, such as the main office, lobby or a highly visible area.    </li>  <li>Motivate students by having friendly competitions between classes. Give prizes like free lunch or bragging rights to teams/students that bring in the most food/funds.  </li>  <li>Have a themed food drive by focusing on one or a couple of items on our most needed items list, such as a tuna drive, bean drive or pasta drive. </li></ul></label><br><label><strong>Most needed items:</strong><ul><li>Baby formula &amp; Food	</li><li>Beans &amp; lentils	</li><li>Canned fruit &amp; vegetables	</li><li>Canned fish &amp; meat	</li><li>Cans of soup or hearty stew	</li><li>Dried pasta &amp; tomato sauce	</li><li>Macaroni &amp; cheese	</li><li>Peanut butter  </li><li>Rice  </li><li>Tetra Pak, canned or powdered milk</li></ul>	</label>	<br><label><strong>Getting the food to us:</strong><ul><li>Use printer paper boxes or one of our bins to hold food in.  </li><li>If you plan on collecting over 300lbs or more (that's 30 grocery bags or 10 printer paper boxes) Daily Bread can deliver a 2x2 and 4ft in height bin to help you store donations. <strong>Please call or email to request to use these bins.  </strong></li><li>At the end of your drive, you can drop off your donations at an on-going drop off location, <a href='../PDFS/01_Donate/01_PDF2_on-going-Food-Drop-Off-Locations-II.pdf' target='_blank'>click here</a> for list.  </li><li>If you are not able to drop off donations, please fill out the food drive pick up form or call us at 416-203-0050. We can schedule a pick up between 11am and 3pm, Mon-Fri. </li></ul></label><br><label>";
			
					
			
			if(tagorganizedby5[intorganizedby5].value == "company")
  	{
				//means dispapire
			tagThankYouMessage.innerHTML += "<strong>Online challenge:</strong><br>Fundraise online during any of our three annual drives - Spring, Fall and Holiday. Our efficient online challenge will allow you to sign up your company team with a logo and create a target. Your supporters will receive an automatic emailed tax receipt for donations over $10. Most importantly, you will be helping us purchase food, get it to those that need it most, and continue our work in advocacy and research! I would be more than happy to help you sign up your team or answer any questions you might have.";
	}
	else if(tagorganizedby5[intorganizedby5].value == "school")
	{
			//means dispapire
			tagThankYouMessage.innerHTML += "<em>Lastly, Hungry City: Make Your Mark</em>, is a Daily Bread Food Bank educational initiative that gives today's youth and educators the opportunity to take action and be part of the fight against hunger in the GTA. Check out <a href='http://www.hungrycity.ca' target='_blank'><strong>www.hungrycity.ca</strong></a> for information and tools that can help you with your upcoming food drive or contact our Public Education Coordinator.";
	}
			
			
			//means dispapire
			tagThankYouMessage.innerHTML += "<br><br>Thanks again for your support in helping to fight hunger in our communities! Please do not hesitate to contact me directly if you require any further assistance.<br><br>Warm Regards,<br><br>Joelle Efford-Gibbons<br>joelle@dailybread.ca<br>416-203-0050 x225</label>";
			
			
			
			//means dispapire
			/*tagThankYouMessage.innerHTML = "<label><strong>Thank you for signing up!</strong><br/><br/>You are now a subscriber to Daily Bread Food Bank's e-newsletter, Newsbytes. You will receive e-alerts when Daily Bread has news to report.</label>";*/
		}//end of if
		else if(htmlJavaServerObject.readyState == 2 && htmlJavaServerObject.status == 500)
		{
			//closes the pop up and removes the textbox so the user cannot use them again until they refresh the page
			endMessage('Unable to Connect to the Server.','',tagThankYouMessage.id,tagGrayOut,tagLightBoxBody);
		}//end of else if
	}//end of function()
	
	htmlJavaServerObject.send("txtorganization5=" + encodeURL(tagorganization5.value) + "&txtcontactperson5=" + encodeURL(tagcontactperson5.value) + "&txtemail5=" + encodeURL(nl2br(tagemail5.value)) + "&txttelephone5=" + encodeURL(tagtelephone5.value) + "&txtfax5=" + encodeURL(tagfax5.value) + "&txtaddress5=" + encodeURL(tagaddress5.value) + "&txtcity5=" + encodeURL(tagcity5.value) + "&txtprovince5=" + encodeURL(nl2br(tagprovince5.value)) + "&txtpostalcode5=" + encodeURL(tagpostalcode5.value) + "&txtstartdate5=" + encodeURL(tagstartdate5.value) + "&txtparnum5=" + encodeURL(tagparnum5.value) + "&txtenddate5=" + encodeURL(tagenddate5.value) + "&txtdescription5=" + encodeURL(tagdescription5.value) + "&txtorganizedby5=" + encodeURL(tagorganizedby5[intorganizedby5].value) + "&txtwhatcollected5=" + encodeURL(tagwhatcollected5[intwhatcollected5].value) + "&txtgoalpounds5=" + encodeURL(taggoalpounds5.value) + "&txtgoaldollars5=" + encodeURL(taggoaldollars5.value) + "&txtmatching5=" + encodeURL(tagmatching5[intmatching5].value) + "&txtspecifics5=" + encodeURL(tagspecifics5.value));

	return true;
}//end of sendReg()

//sends an email to for the Third form
function sendThird(strFileName,tagGrayOut,tagErrorMessage,tagThankYouMessage,tagLightBoxBody,txtorganization6,txtcontactperson6,txtemail6,txttelephone6,txtfax6,txtorganizationtype6,txtaddress6,txtcity6,txtprovince6,txtpostalcode6,txteventname6,txteventdate6,txteventtime6,txteventdescription6,txtlocation6,txtnumofattendees6,txtdemographics6,txtmoneyraised6,txtfoodweight6,txtdatesent6,txtadditionalneeds6,txtbarrels6,lblorganization6,lblcontactperson6,lblemail6,lbltelephone6,lblfax6,lblorganizationtype6,lbladdress6,lblcity6,lblprovince6,lblpostalcode6,lbleventname6,lbleventdate6,lbleventtime6,lbleventdescription6,lbllocation6,lblnumofattendees6,lbldemographics6,lblmoneyraised6,lblfoodweight6,lbldatesent6,lbladditionalneeds6,lblbarrels6)
{
	var strFilter = /^.+@.+\..{2,3}$/;//holds the filtter for the Email
	var htmlJavaServerObject = getXMLHttpRequest();//holds the object of the server
	var boolErrors = false;//holds the check if there is an error on the form
	var intorganizationtype6 = validateRadio(txtorganizationtype6);
	var intdemographics6 = validateRadio(txtdemographics6);
	var intadditionalneeds6 = validateRadio(txtadditionalneeds6);

	//checks if they have a organization
	if (txtorganization6.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblorganization6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if they have a last name
	if (txtcontactperson6.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblcontactperson6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
					
	
	//checks if there the E-Mail Format is current
	if (txtemail6.value != "" && strFilter.test(txtemail6.value) == false)
  	{
		displayMessage(tagErrorMessage,'Error! Please input valid e-mail address',true,true);
		lblemail6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	else if (txtemail6.value != "" && txtemail6.value.match(/[\(\)\<\>\,\;\:\\\/\"\[\]]/))
  	{
		displayMessage(tagErrorMessage,'Error! Your e-mail address contains illegal characters.',true,true);
		lblemail6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
		//checks if there is E-Mail
	if (txtemail6.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblemail6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
		//checks if there is E-Mail
	if (txttelephone6.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbltelephone6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	//checks if there is E-Mail
	if (txtaddress6.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbladdress6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is E-Mail
	if (txtcity6.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblcity6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	//checks if there is E-Mail
	if (txtprovince6.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblprovince6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is E-Mail
	if (txtpostalcode6.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lblpostalcode6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	
	
		//checks if there is E-Mail
	if (txteventname6.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbleventname6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
		
	
		//checks if there is E-Mail
	if (txteventdate6.value == "" || txteventdate6.value == "mm/dd/yy")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbleventdate6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
		//checks if there is E-Mail
	if (txteventtime6.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbleventtime6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
		
		//checks if there is E-Mail
	if (txtadditionalneeds6.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbladditionalneeds6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
			//checks if there is E-Mail
	if (txteventdescription6.value == "")
  	{
		displayMessage(tagErrorMessage,'Error! Please fill out the missing fields.',true,true);
		lbleventdescription6.style.color = "#FF0000";
		boolErrors = true;
	}//end of if
	
	//checks if there is any errors in the form
	if(boolErrors == true)
		return false;
	
	//Abort any currently active request.
	htmlJavaServerObject.abort();
	
	//prepers the form for sending
	preSendToServer(tagThankYouMessage,tagLightBoxBody,'Sending Data...');
	
	//Makes a request
 	htmlJavaServerObject.open("Post", strFileName, true);
	htmlJavaServerObject.setRequestHeader("Content-Type","application/x-www-form-urlencoded");

	htmlJavaServerObject.onreadystatechange = function(){
    	if(htmlJavaServerObject.readyState == 4 && htmlJavaServerObject.status == 200)
		{
			//resets the fields and disables the field area
            txtorganization6.value = "";
			txtcontactperson6.value = "";
			txtemail6.value = "";
			txttelephone6.value = "";
			txtfax6.value = "";
			txtorganizationtype="";
			txtaddress6.value = "";
			txtcity6.value = "";
			txtprovince6.value = "";
			txtpostalcode6.value = "";
			txteventname6.value = "";
			txteventdate6.value = "";
			txteventtime6.value = "";
			txteventdescription6.value = "";
			txtlocation6.value = "";
			txtnumofattendees6.value = "";
			txtdemographics6.value = "";
			txtmoneyraised6.value = "";
			txtfoodweight6.value = "";
			txtdatesent6.value = "";
			txtadditionalneeds6.value = "";
			txtbarrels6.value = "";
			
			//means dispapire
			tagThankYouMessage.innerHTML = "<label>Thanks for registering your third party event. A staff member will be in touch soon to be sure you have the resources you need to run a successful event.<label>";
		}//end of if
		else if(htmlJavaServerObject.readyState == 2 && htmlJavaServerObject.status == 500)
		{
			//closes the pop up and removes the textbox so the user cannot use them again until they refresh the page
			endMessage('Unable to Connect to the Server.','',tagThankYouMessage.id,tagGrayOut,tagLightBoxBody);
		}//end of else if
	}//end of function()

	htmlJavaServerObject.send("txtorganization6=" + encodeURL(txtorganization6.value) + "&txtcontactperson6=" + encodeURL(txtcontactperson6.value) + "&txtemail6=" + encodeURL(nl2br(txtemail6.value)) + "&txttelephone6=" + encodeURL(txttelephone6.value) + "&txtfax6=" + encodeURL(txtfax6.value) + "&txtorganizationtype6=" + encodeURL(txtorganizationtype6[intorganizationtype6].value) + "&txtaddress6=" + encodeURL(txtaddress6.value) + "&txtcity6=" + encodeURL(txtcity6.value) + "&txtprovince6=" + encodeURL(txtprovince6.value) + "&txtpostalcode6=" + encodeURL(txtpostalcode6.value) + "&txteventname6=" + encodeURL(txteventname6.value) + "&txteventdate6=" + encodeURL(txteventdate6.value) + "&txteventtime6=" + encodeURL(txteventtime6.value) + "&txteventdescription6=" + encodeURL(txteventdescription6.value) + "&txtlocation6=" + encodeURL(txtlocation6.value) + "&txtnumofattendees6=" + encodeURL(txtnumofattendees6.value) + "&txtdemographics6=" + encodeURL(txtdemographics6[intdemographics6].value) + "&txtmoneyraised6=" + encodeURL(txtmoneyraised6.value) + "&txtfoodweight6=" + encodeURL(txtfoodweight6.value) + "&txtdatesent6=" + encodeURL(txtdatesent6.value) + "&txtadditionalneeds6=" + encodeURL(txtadditionalneeds6[intadditionalneeds6].value) + "&txtbarrels6=" + encodeURL(txtbarrels6.value));

	return true;
}//end of sendThird()

//starts up the page
function startUp()
{
	var oldonload=window.onload;//holds any prevs onload function from the js file

	//gets the onload window event checks if there is a function that is already in there
	window.onload=function(){
		if(typeof(oldonload)=='function')
			oldonload();
			
		//starts the Vertical Ticker
		start();
						
		//finds which browser the user is using for Firefox it is the defult
		//for IE 
		if (navigator.userAgent.indexOf('MSIE') != -1)
		{					
			//checks if IE is 7 as IE 8 is more standards compliated
			if(navigator.appVersion.indexOf('MSIE 7') != -1)
			{
			}//end of if
		}//end of if
		//for Safari and Mac
		else if (navigator.userAgent.indexOf('Safari') !=-1 || navigator.platform.indexOf("Mac") > -1)
		{
			
		}//end of if else
		//for firefox
		else if (navigator.userAgent.indexOf('Firefox') !=-1)
		{
		}//end of if else
		//for Opera
		else if (navigator.userAgent.indexOf('Opera') !=-1)
		{
			
		}//end of if else
	}//end of window.onload=function()
}//end of startUp()

//shoes and hides a <div> using display:block/none from the CSS
function toggleLayer(tagLayer,tagGrayOut,tagMedia)
{
	var tagStyle = '';//holds the style of tagLayer

	//gets the tagLayer and tagGrayOut Properties
	tagStyle = getDocID(tagLayer);
	tagGrayOut = getDocID(tagGrayOut);
	tagMedia = getDocID(tagMedia);
		
	if (tagStyle != null)
	{tagStyle.style.display = tagStyle.style.display? "":"block";}
	
	if (tagGrayOut != null)
	{
		tagGrayOut.style.display = tagGrayOut.style.display? "":"block";

		//for IE
		if (navigator.userAgent.indexOf('MSIE') != -1)
		{
			tagGrayOut.attachEvent('onclick',function () {
				toggleLayer(tagStyle.id,tagGrayOut.id)
				
				//specal case pleace remove when REUSING THIS FUNCTION UNLESS YOU ARE USING IT Email TO A FRIEND	
	
				//checks if there is any Media to stop also pleace remove when
				if (tagMedia != null)
					tagMedia.Stop();
			});
		}//end of if
		//for the other browsers
		else
		{
			tagGrayOut.addEventListener('click',function () {

			//specal case pleace remove when REUSING THIS FUNCTION UNLESS YOU ARE USING IT Email TO A FRIEND
				
				toggleLayer(tagStyle.id,tagGrayOut.id);
			},false);
		}//end of else
	}//end of if
}//end of toggleLayer()

//validates if there is a value in a radio button
//has to uses the displayMessage as it also gets the value
function validateRadio(tagRate)
{
	var intRating = -1;//holds the current rating
		
	//Goes around checking each radio button
	for (intIndex = 0; intIndex < tagRate.length; intIndex++)
	{
		//checks if any of the radio box have been click
		if (tagRate[intIndex].checked == true)
			intRating = intIndex; 
	}//end of for loop

	return intRating;
}//end of validateRadio()

//checks if the link is valed
function validateLinks(tagLink,tagMessage)
{
	var tagLink = getDocID(tagLink);//holds the text box Link
	
	//checks if the link is current and if the format is current
	if (tagLink.value==""||tagLink.value=="http://"){
		displayMessage(tagMessage,'Invalidted Link',true,true);
		return false;
	}//end of if
		
	//opens a window for the user in order for them to check if the link works
	window.open(tagLink.value);

	return true;
}//end of validateLinks()

//checks if the count of the text in the textarea is in the limits of the maxlength
function validateTextAreaCount(text,long,tagMessage,strMessage)
{
	var maxlength = new Number(long);//Change number to your max length.

	if (text.value.length > maxlength)
	{
		text.value = text.value.substring(0,maxlength);
		displayMessage(tagMessage,"Only " + long + " chars for " + strMessage,true,true);
	}//end of if
}//end of validateTextAreaCount()

/* 
  ------------------------------------------------
  PVII Equal CSS Columns scripts -Version 2
  Copyright (c) 2005 Project Seven Development
  www.projectseven.com
  Version: 2.1.0
  ------------------------------------------------
*/
function P7_colH2(){ //v2.1.0 by PVII-www.projectseven.com
 var i,oh,h=0,tg,el,np,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){
 for(i=1;i<dA.length;i+=2){dA[i+1].style.paddingBottom='';}for(i=1;i<dA.length;i+=2){
 oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=1;i<dA.length;i+=2){oh=dA[i].offsetHeight;
 if(oh<h){np=h-oh;if(!an&&dA[0]==1){P7_eqA2(dA[i+1].id,0,np);}else{
 dA[i+1].style.paddingBottom=np+"px";}}}document.p7eqa=1;
 document.p7eqth=document.body.offsetHeight;
 document.p7eqtw=document.body.offsetWidth;}
}
function P7_eqT2(){ //v2.1.0 by PVII-www.projectseven.com
 if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth){P7_colH2();}
}
function P7_equalCols2(){ //v2.1.0 by PVII-www.projectseven.com

    var c,e,el;if(document.getElementById){document.p7eqc=new Array();
    document.p7eqc[0]=arguments[0];for(i=1;i<arguments.length;i+=2){el=null;
    c=document.getElementById(arguments[i]);if(c){e=c.getElementsByTagName(arguments[i+1]);
    if(e){el=e[e.length-1];if(!el.id){el.id="p7eq"+i;}}}if(c&&el){
    document.p7eqc[document.p7eqc.length]=c;document.p7eqc[document.p7eqc.length]=el}}
    setInterval("P7_eqT2()",10);}
   
    
}
function P7_eqA2(el,p,pt){ //v2.1.0 by PVII-www.projectseven.com
 var sp=10,inc=20,g=document.getElementById(el);np=(p>=pt)?pt:p;
 g.style.paddingBottom=np+"px";if(np<pt){np+=inc;
 setTimeout("P7_eqA2('"+el+"',"+np+","+pt+")",sp);}
}

/* test */
function alertSize() {
  var myWidth = 0;//, myHeight = 0;
//  if( typeof( window.innerWidth ) == 'number' ) {
//    //Non-IE
//    myWidth = window.innerWidth;
//    myHeight = window.innerHeight;
//  } else 
if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    //myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    //myHeight = document.body.clientHeight;
  }
  
  return myWidth;
  //window.alert( 'Height = ' + myHeight );
}