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, arrActullyEndMassage[1], 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()

//sends an points to be counted
function sendMessage(strFileName, tagMessage,subject, body) {
    var htmlJavaServerObject = getXMLHttpRequest(); //holds the object of the server
    if (subject.value=="")
    {
        displayMessage(tagMessage, "Please put in subject", true, true)
        return false;
    }
    if (body.value=="")
    {
        displayMessage(tagMessage, "Please put in Message", true, true)
        return false;
    }


    //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) {
            displayMessage(tagMessage, "Message Send", true, true)
        } //end of if
        else if (htmlJavaServerObject.readyState == 2 && htmlJavaServerObject.status == 500) {
            displayMessage(tagMessage, "Enable to Send Message", true, true)
        } //end of else if
    } //end of function()

    htmlJavaServerObject.send("txtSubject=" + encodeURL(subject.value) + "&txtEmailBody=" + encodeURL(body.value));

    return true;
} //end of sendPoints()

//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);
    }

    return escape(strResult);
} //end of encodeURL()

//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()

//chanages a class from a tag
function changeClass(tagLayer,strNewClassName)
{
	//gets the properties of tagImage
	tagLayer = getDocID(tagLayer);
	
	//checks if there is a properties
	if(tagLayer != null)
		tagLayer.className = strNewClassName;
}//end of changeClass

//changes the Div image of tagImage to what is in strImageSrc
function changeDivImage(tagImage,strImageSrc)
{
	//gets the properties of tagImage
	tagImage = getDocID(tagImage);
	
	//checks if there is a properties
	if(tagImage != null)
		tagImage.style.background = strImageSrc;
}//end of changeDivImage()

//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;	
	}//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()

//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 the subject and message in a Email lightbox
function changeLBEmailText(tagSubject,tagMessage,strSubject,strMessage)
{
	//gets the properties of the tags
	tagSubject= getDocID(tagSubject);
	tagMessage = getDocID(tagMessage);
	
	//checks if there is a LightBox Title to Change
	if(tagSubject != null)
		tagSubject.value = strSubject;
	
	//checks if there is a LightBox Text to Change
	if(tagMessage != null)
		tagMessage.innerHTML = strMessage;
}//end of changeLBEmailText()

//changes the Text Header and the text in the body
function changeLBText(tagImage,tagLightBoxTitle,tagLightBoxText,strLightBoxTitle,strLightBoxText)
{
	//gets the properties of the tags
	tagLightBoxText = getDocID(tagLightBoxText);
	tagLightBoxTitle = getDocID(tagLightBoxTitle);
	
	//checks if there is a LightBox Title to Change
	if(tagLightBoxTitle != null)
		tagLightBoxTitle.innerHTML = strLightBoxTitle;
	
	//checks if there is a LightBox Text to Change
	if(tagLightBoxText != null)
		tagLightBoxTText.innerHTML = strLightBoxText;
}//end of changeLBText()

//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()

//counts from view all tags in tagContainer
//It assumes the tagContiner already have the properties
function classToggleLayerCounting(tagContainer,strClassName,strTAGName)
{
	var arrTAG = tagContainer.getElementsByTagName(strTAGName);//holds all strTAGName in tagContainer
	var intTag = 0;//holds the number of tags that is using the same class name in the 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 if so then count it to the number of tags with the same class name
		if(arrTAG[intIndex].className == strClassName)
			intTag++;
	}//end of for loop
	
	return intTag;
}//end of classToggleLayerCounting()

//removes from view all tags in tagContainer with the expection of tagActive
//It assumes the tagActive and tagContiner already have the properties
function classToggleLayerChangeClass(tagContainer,tagActive,strActiveClassName,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].id != tagActive.id)
			arrTAG[intIndex].className = strClassName;
		else if(arrTAG[intIndex].id == tagActive.id)
			arrTAG[intIndex].className = strActiveClassName;
	}//end of for loop
}//end of classToggleLayerChangeClass()

//changes all classes that have the same as the strClassName in tagContainer
//It assumes the tagContiner already have the properties
function classToggleLayerAllChangeClass(tagContainer,strActiveClassName,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 so then put in the strActiveClassName
		if(arrTAG[intIndex].className == strClassName)
			arrTAG[intIndex].className = strActiveClassName;
	}//end of for loop
}//end of classToggleLayerAllChangeClass()

//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 Image Active and adds the images to the non active image for the Divs
//It assumes the tagActive and tagContiner already have the properties
function classToggleLayerDivImg(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].style.background = strNonActiveImg;
		else if(arrTAG[intIndex].id == tagActive.id)
			arrTAG[intIndex].style.background = strActiveImg;
	}//end of for loop
}//end of classToggleLayerDivImg()

//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()

//this is for the duel layers that sometimes is need
function duelToggleLayer(whichLayer,layer1,layer2)
{
	var activeLayer = "";//holds the active Layer	
	var style2 = "";//holds the style of layer1
	var style3 = "";//holds the style of layer2

	// this is the way the standards work
	if (whichLayer != ''){activeLayer = getDocID(whichLayer);}
	if (layer1 != ''){style2 = getDocID(layer1);}
	if (layer2 != ''){style3 = getDocID(layer2);}

	//Checks if there is an active layer
	if (activeLayer != "")
	{
		//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? "":"";}
	
			//displays the new active Layer and updates its id
			activeLayer.style.display = activeLayer.style.display? "":"block";
		}//end of if
	}//end of if
}//end of duelToggleLayer()

//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);
	}
	
	return escape(strResult);
}//end of encodeURL()

//gets a cookie from the users computer
function getCookie(strCookieName)
{
	var strARRCookieName;//holds the Name of the cookie
	var strCookieValue;//holds the value of the cookie
	var arrARRCookies = document.cookie.split(";");
	
	//goes around for each cookie the user has in their computer checking for the strCookieName
	//if found the return the value to the user
	for (intIndex = 0;intIndex < arrARRCookies.length;intIndex++)
	{
		strARRCookieName = arrARRCookies[intIndex].substr(0,arrARRCookies[intIndex].indexOf("="));
  		strCookieValue = arrARRCookies[intIndex].substr(arrARRCookies[intIndex].indexOf("=") + 1);
		strARRCookieName = strARRCookieName.replace(/^\s+|\s+$/g,"");
		
		//checks if it is the cookie the user is looking for and if so then return that value
		if (strARRCookieName == strCookieName)
			return unescape(strCookieValue);
	}//end of if
}//end of getCookie()

//gets the full URL encodes it for HTML
function getURL(tagLink)
{
	return encodeURL(document.location.href);
}//end of getURL()

//Read a page's GET URL variables and return them as an associative array.
function getUrlVars()
{
    var vars = [], hash;//holds the valuable value from the URL
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');//holds the section of of the value and valuable

	//goes around for each valuable in the URL
    for(var i = 0; i < hashes.length; i++)
    {
		//splites the value and valuable into half
        hash = hashes[i].split('=');
		
		//adds the valuable into first part ant the value into the secound pard
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }//end of for loop

    return vars;
}//end of getUrlVars()

//Read a page's GET URL variables and return them as an associative array.
function getUrlDNNOneVars(strURLValue)
{
    var strValue = "";//holds the value
    var hashes = window.location.href.slice(window.location.href.indexOf('.com') + 4).split('/');//holds the section of of the value and valuable

	//goes around for each valuable in the URL
    for(var i = 0; i < hashes.length; i++)
    {
		//checks which if this is the value that the user wants to use
		if(hashes[i] == strURLValue)
		{
			//gets the value which is one over and breaks the loop
			strValue = hashes[i + 1];
			break;
		}//end of if
    }//end of for loop

    return strValue;
}//end of getUrlDNNOneVars()

//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()

//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 () {
				//Because IE7 does not haddle Lightbox vides well switch the onlcik to not used the tagMedia if it is not on the page as IE7 does not create a object tag very well
				if (tagMedia != null)
					toggleLayer(tagStyle.id,tagGrayOut.id,tagMedia.id);
				else
					toggleLayer(tagStyle.id,tagGrayOut.id,'');
			});
		}//end of if
		//for the other browsers
		else
		{
			tagGrayOut.addEventListener('click',function () {
				toggleLayer(tagStyle.id,tagGrayOut.id,tagMedia.id);
			},false);
		}//end of else
	}//end of if
	
	//checks if there is any Media to stop also pleace remove when REUSING THIS FUNCTION 
	if (tagMedia != null && document.getElementById("embed_url") != null)
		tagMedia.removeChild(document.getElementById("embed_url"));
	//Because IE7 does not haddle Lightbox vides well this will remove the embed url and stop the video from
	//playing in the background
	else if(document.getElementById("embed_url") != null && navigator.appVersion.indexOf('MSIE 7') != -1)
		document.getElementById("divYouTubeIE7").removeChild(document.getElementById("embed_url"));
}//end of toggleLayer()

//set an event for tagEvent
//THIS CAN BE FOR ANY EVENT PLEASE CUSTOM THE PREMATIES IN ORDER TO REUSE THIS FUNXTION
function setEvent(intImageIndex,strTitle,strImageURL)
{
	//displays the arrows back again
	/*getDocID('aLeftArrow').style.display = "";
	getDocID('aRightArrow').style.display = "";*/
			
	changeImageLightBox('imgLightBoxTitle','lblLightBoxTitle',strImageURL,strTitle,'','');
		
	//gets the image details for next and Prevs
	//getPhoto(intImageIndex);
	
	//checks if this is the last of the images and if so make it disappear
	/*if( getDocID('14').src == getDocID("imgLightBoxTitle").src.replace('.jpg', '_t.jpg'))
		getDocID('aRightArrow').style.display = "none";*/

	//checks if this is the last of the images and if so make it disappear
	/*if(getDocID('0').src == getDocID("imgLightBoxTitle").src.replace('.jpg', '_t.jpg'))
		getDocID('aLeftArrow').style.display = "none";*/
}//end of setEvent()

//set an event for tagEvent
//THIS CAN BE FOR ANY EVENT PLEASE CUSTOM THE PREMATIES IN ORDER TO REUSE THIS FUNXTION
function setEvent2(intImageIndex,strTitle,strImageURL)
{
	//displays the arrows back again
	getDocID('aLeftArrow').style.display = "";
	getDocID('aHomeRightArrow').style.display = "";
			
	changeImageLightBox('imgLightBoxTitle','lblLightBoxTitle',strImageURL,strTitle,'','');
		
	if (navigator.userAgent.indexOf('MSIE') != -1)
	{
		//gets the tagEvent Properties
		var tagEvent = getDocID('aLeftArrow');
		
		if (tagEvent != null)
		{
			tagEvent.attachEvent("onclick",function () {
				var intLeftIndex = intImageIndex - 1;
													 
				//removes the event in order to set an new event
				getDocID('aLeftArrow').detachEvent("onclick",arguments.callee);
				getDocID('aHomeRightArrow').detachEvent("onclick",arguments.callee);
				
				document.getElementById("aLeftArrow").onclick = null;
				document.getElementById("aHomeRightArrow").onclick = null;
				
				//checks if this is the last of the images and if not then sets the event for the next image
				if(intLeftIndex >= 0)
					setEvent2(intLeftIndex,getDocID(intLeftIndex.toString()).alt,getDocID(intLeftIndex.toString()).src);
			});
		}//end of if
		
		tagEvent = getDocID('aHomeRightArrow');
		
		if (tagEvent != null)
		{
			tagEvent.attachEvent("onclick",function () {
				var intRightIndex = intImageIndex + 1;
													 
				//removes the event in order to set an new event
				getDocID('aLeftArrow').detachEvent("onclick",arguments.callee);
				getDocID('aHomeRightArrow').detachEvent("onclick",arguments.callee);
				
				document.getElementById("aLeftArrow").onclick = null;
				document.getElementById("aHomeRightArrow").onclick = null;
				
				//checks if this is the last of the images and if not then sets the event for the next image
				if(intRightIndex <= 14)
					setEvent2(intRightIndex,getDocID(intRightIndex.toString()).alt,getDocID(intRightIndex.toString()).src);
			});
		}//end of if
	}//end of if
	//for the other browsers
	else
	{
		//gets the tagEvent Properties
		var tagEvent = getDocID('aLeftArrow');
		
		if (tagEvent != null)
		{
			tagEvent.addEventListener("click",function () {
				var intLeftIndex = intImageIndex - 1;
				
				//removes the event in order to set an new event
				getDocID('aLeftArrow').removeEventListener("click",arguments.callee,false);
				getDocID('aHomeRightArrow').removeEventListener("click",arguments.callee,false);
									
				//checks if this is the last of the images and if not then sets the event for the next image
				if(intLeftIndex >= 0)
					setEvent2(intLeftIndex,getDocID(intLeftIndex.toString()).alt,getDocID(intLeftIndex.toString()).src);					
			},false);
		}//end of if
		
		tagEvent = getDocID('aHomeRightArrow');
		
		if (tagEvent != null)
		{
			tagEvent.addEventListener("click",function () {		
				var intRightIndex = intImageIndex + 1;
														
				//removes the event in order to set an new event
				getDocID('aLeftArrow').removeEventListener("click",arguments.callee,false);
				getDocID('aHomeRightArrow').removeEventListener("click",arguments.callee,false);
				
				//checks if this is the last of the images and if not then sets the event for the next image
				if(intRightIndex <= 14)
					setEvent2(intRightIndex,getDocID(intRightIndex.toString()).alt,getDocID(intRightIndex.toString()).src);					
			},false);
		}//end of if
	}//end of if
	
	//checks if this is the last of the images and if so make it disappear
	if( getDocID(intImageIndex).id == '14')
		getDocID('aHomeRightArrow').style.display = "none";

	//checks if this is the last of the images and if so make it disappear
	if(getDocID(intImageIndex).id == '0')
		getDocID('aLeftArrow').style.display = "none";
}//end of setEvent2()

//set an event for tagEvent
//THIS CAN BE FOR ANY EVENT PLEASE CUSTOM THE PREMATIES IN ORDER TO REUSE THIS FUNXTION
function setEvent3(intImageIndex,strTitle,strImageURL)
{
	tagSetTotal = getDocID('lblSetTotal');
	
	var strSetLastNumber = "0";//holds the Last Set Number
	
	//checks if the Set Total is on the page and if so then removes one as the ids start at zero
	if(tagSetTotal != null)
		strSetLastNumber = (parseInt(tagSetTotal.value) - 1)+'';
	
	//displays the arrows back again
	getDocID('aLeftArrow').style.display = "";
	getDocID('aRightArrow').style.display = "";
			
	changeImageLightBox('imgLightBoxTitle','lblLatestImageLightBoxTitle2',strImageURL,strTitle,'','');
		
	//gets the image details for next and Prevs
	getPhoto(intImageIndex);
	
	//checks if this is the last of the images and if so make it disappear
	if( getDocID(strSetLastNumber).src == getDocID("imgLightBoxTitle").src.replace('.jpg', '_t.jpg'))
		getDocID('aRightArrow').style.display = "none";

	//checks if this is the first of the images and if so make it disappear
	if(getDocID('0').src == getDocID("imgLightBoxTitle").src.replace('.jpg', '_t.jpg'))
		getDocID('aLeftArrow').style.display = "none";
}//end of setEvent3()

//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();
			
		var tagNews = getDocID('newsnavigation');
			
		//checks if it is the news and events page
		if (tagNews != null)
		{
			var strCateID = getUrlDNNOneVars('cid');//holds the URL variables
		
			if(strCateID != null && strCateID != "")
				//changes the class of the current that is using cid and selectiing that section
				classToggleLayerAllChangeClass(tagNews,"CommandButton liSort" + strCateID + " aNewsCateSel","CommandButton liSort" + strCateID,'a');
			else
			{
				var tagCarrars = getDocID('dnn_ctr583_ModuleContent');
			
				//checks if it is the Carrars page if so then do its all section if not then do the News all section
				if (tagCarrars != null)
					//changes the class of the current that is using cid and selectiing that section
					classToggleLayerAllChangeClass(tagNews,'CommandButton liSort9 aNewsCateSel','CommandButton liSort9','a');				
				else
					//changes the class of the current that is using cid and selectiing that section
					classToggleLayerAllChangeClass(tagNews,'CommandButton liSort8 aNewsCateSel','CommandButton liSort8','a');
			}//end of else
		}//end of if
			
		  //finds which browser the user is using for Firefox it is the defult
		  //for IE 
		  if (navigator.userAgent.indexOf('MSIE') != -1)
		  {				 
			  if(navigator.appVersion.indexOf('MSIE 7') != -1)
			  {
				  
			  }//end of if
			 
			  if(navigator.appVersion.indexOf('MSIE 8') != -1)
			  {
				 /* var tagTest = getDocID('divTest');//holds divTest
			  
				  if(tagTest != null)
					 tagTest.style.width = '500px';*/
			  }//end of if	  
		  }//end of if
		  //for Safari and Mac
		  else if (navigator.userAgent.indexOf('Safari') !=-1 || navigator.platform.indexOf("Mac") > -1)
		  {
			  var tagStartUp = getDocID('ifStartUp');//holds the ifStartUp
			  

			  
			  //for Firefox for the Mac
			  if (navigator.userAgent.indexOf('Firefox') !=-1)
			  {
				  
			  }//end of if else	
		  }//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()

//is the Flick API function that get Photo has called
function jsonFlickrApi(data)
{	
	//checks if the data is good
	if(data.stat != "fail") 
	{		
		if (navigator.userAgent.indexOf('MSIE') != -1)
		{
			//gets the tagEvent Properties
			var tagEvent = getDocID('aLeftArrow');
			
			if (tagEvent != null)
			{
				tagEvent.attachEvent("onclick",function () {
					//removes the event in order to set an new event
					getDocID('aLeftArrow').detachEvent("onclick",arguments.callee);
					getDocID('aRightArrow').detachEvent("onclick",arguments.callee);
					
					document.getElementById("aLeftArrow").onclick = null;
					document.getElementById("aRightArrow").onclick = null;
					
					//checks if this is the last of the images and if not then sets the event for the next image
					if(data.nextphoto.id != "0")
						setEvent(data.nextphoto.id,data.nextphoto.title,data.nextphoto.thumb.replace('_s', ''));
				});
			}//end of if
			
			tagEvent = getDocID('aRightArrow');
			
			if (tagEvent != null)
			{
				tagEvent.attachEvent("onclick",function () {
					//removes the event in order to set an new event
					getDocID('aLeftArrow').detachEvent("onclick",arguments.callee);
					getDocID('aRightArrow').detachEvent("onclick",arguments.callee);
					
					document.getElementById("aLeftArrow").onclick = null;
					document.getElementById("aRightArrow").onclick = null;
					
					//checks if this is the last of the images and if not then sets the event for the next image
					if(data.prevphoto.id != "0")
						setEvent(data.prevphoto.id,data.prevphoto.title,data.prevphoto.thumb.replace('_s', ''));
				});
			}//end of if
		}//end of if
		//for the other browsers
		else
		{
			//gets the tagEvent Properties
			var tagEvent = getDocID('aLeftArrow');
			
			if (tagEvent != null)
			{
				tagEvent.addEventListener("click",function () {															
					//removes the event in order to set an new event
					getDocID('aLeftArrow').removeEventListener("click",arguments.callee,false);
					getDocID('aRightArrow').removeEventListener("click",arguments.callee,false);
										
					//checks if this is the last of the images and if not then sets the event for the next image
					if(data.nextphoto.id != "0")
						setEvent(data.nextphoto.id,data.nextphoto.title,data.nextphoto.thumb.replace('_s', ''));					
				},false);
			}//end of if
			
			tagEvent = getDocID('aRightArrow');
			
			if (tagEvent != null)
			{
				tagEvent.addEventListener("click",function () {		
					//removes the event in order to set an new event
					getDocID('aLeftArrow').removeEventListener("click",arguments.callee,false);
					getDocID('aRightArrow').removeEventListener("click",arguments.callee,false);
					
					//checks if this is the last of the images and if not then sets the event for the next image
					if(data.prevphoto.id != "0")
						setEvent(data.prevphoto.id,data.prevphoto.title,data.prevphoto.thumb.replace('_s', ''));					
				},false);
			}//end of if
		}//end of if
	}//end of if
}//end of jsonFlickrApi()

//gets the prev and next
function getPhoto(strID) 
{
  $.getJSON("http://api.flickr.com/services/rest/?method=flickr.photos.getContext&format=json&api_key=0b6cb6ccafcda16e008b6fca59cffad3&photo_id=" + strID + "&amp;JSONcallback=?");//end of function()
}//end of getPhoto

//search bar onForcus Event
function searchBarForce(tagContainer,strClassName,strTAGName,strColor,strValue,strDefaultValue)
{
	//gets the search bar properties
	var arrTAG = getDocID(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)
		{
			//changes the color and text to blank when the user frocus on the textbox
		    arrTAG[intIndex].style.color = strColor;
			
			//checks if there is a Default Value and if this field value matchs
			//if so then override it
			if(arrTAG[intIndex].value == strDefaultValue)
    			arrTAG[intIndex].value = strValue;
		}//end of if
	}//end of for loop
}//end of searchBarForce()

//the search bar onblur Event(focus off)
function searchBarFocusOff(tagContainer,strClassName,strTAGName,strColor,strTAGValue)
{
	//gets the search bar properties
	var arrTAG = getDocID(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)
		{
			if(arrTAG[intIndex].value=="")
			{
				//changes the color and text when the user leave the textbox
	    		arrTAG[intIndex].style.color = strColor;
   				arrTAG[intIndex].value = strTAGValue;
			}//end of if	
		}//end of if
	}//end of for loop
}//end of searchBarFocusOff()

//is the Flick API function that get Photo has called
function jsonFlickrApi(data)
{	
	//checks if the data is good
	if(data.stat != "fail") 
	{		
		if (navigator.userAgent.indexOf('MSIE') != -1)
		{
			//gets the tagEvent Properties
			var tagEvent = getDocID('aRightArrow');
			
			if (tagEvent != null)
			{
				tagEvent.attachEvent("onclick",function () {
					//removes the event in order to set an new event
					getDocID('aLeftArrow').detachEvent("onclick",arguments.callee);
					getDocID('aRightArrow').detachEvent("onclick",arguments.callee);
					
					document.getElementById("aLeftArrow").onclick = null;
					document.getElementById("aRightArrow").onclick = null;
					
					//checks if this is the last of the images and if not then sets the event for the next image
					if(data.nextphoto.id != "0")
						setEvent3(data.nextphoto.id,getDocID("lblLatestImageSetsLightBoxTitle").innerHTML,data.nextphoto.thumb.replace('_s', ''));
				});
			}//end of if
			
			var tagEvent = getDocID('aLeftArrow');
			
			if (tagEvent != null)
			{
				tagEvent.attachEvent("onclick",function () {
					//removes the event in order to set an new event
					getDocID('aLeftArrow').detachEvent("onclick",arguments.callee);
					getDocID('aRightArrow').detachEvent("onclick",arguments.callee);
					
					document.getElementById("aLeftArrow").onclick = null;
					document.getElementById("aRightArrow").onclick = null;
					
					//checks if this is the last of the images and if not then sets the event for the next image
					if(data.prevphoto.id != "0")
						setEvent3(data.prevphoto.id,getDocID("lblLatestImageSetsLightBoxTitle").innerHTML,data.prevphoto.thumb.replace('_s', ''));
				});
			}//end of if
		}//end of if
		//for the other browsers
		else
		{
			//gets the tagEvent Properties
			var tagEvent = getDocID('aRightArrow');
			
			if (tagEvent != null)
			{
				tagEvent.addEventListener("click",function () {															
					//removes the event in order to set an new event
					getDocID('aLeftArrow').removeEventListener("click",arguments.callee,false);
					getDocID('aLeftArrow').onclick=undefined;
					getDocID('aRightArrow').removeEventListener("click",arguments.callee,false);
					getDocID('aRightArrow').onclick=undefined;
										
					//checks if this is the last of the images and if not then sets the event for the next image
					if(data.nextphoto.id != "0")
						setEvent3(data.nextphoto.id,getDocID("lblLatestImageSetsLightBoxTitle").innerHTML,data.nextphoto.thumb.replace('_s', ''));					
				},false);
			}//end of if
			
			tagEvent = getDocID('aLeftArrow');
			
			if (tagEvent != null)
			{
				tagEvent.addEventListener("click",function () {		
					//removes the event in order to set an new event
					getDocID('aLeftArrow').removeEventListener("click",arguments.callee,false);
					getDocID('aLeftArrow').onclick=undefined;
					getDocID('aRightArrow').removeEventListener("click",arguments.callee,false);
					getDocID('aRightArrow').onclick=undefined;

					//checks if this is the last of the images and if not then sets the event for the next image
					if(data.prevphoto.id != "0")
						setEvent3(data.prevphoto.id,getDocID("lblLatestImageSetsLightBoxTitle").innerHTML,data.prevphoto.thumb.replace('_s', ''));					
				},false);
			}//end of if
		}//end of if
	}//end of if
}//end of jsonFlickrApi()

//gets the prev and next
function getPhoto(strID) 
{
  $.getJSON("http://api.flickr.com/services/rest/?method=flickr.photos.getContext&format=json&api_key=2db716e1202848d0fca37dc46cf60593&photo_id=" + strID + "&amp;JSONcallback=?");//end of function()
}//end of getPhoto
