/// <summary>
///  Custom Global variables
/// </summary>

var MenuHighlightedKeyword = "Active";
var ShowRequestedImageDelay = 50;

/// <summary>
///  These functions set global browser identification variables and include commonly used routines
///  Significant portions of this code are based on Zorn, W. (2005), "wz_tooltip.js v. 3.37", www.walterzorn.com [http://www.walterzorn.com/tooltip/tooltip_e.htm] cited below
///
///  wz_tooltip.js    v. 3.37
///  The latest version is available at http://www.walterzorn.com or http://www.devira.com or http://www.walterzorn.de
///  Copyright (c) 2002-2005 Walter Zorn. All rights reserved.
///  Created 1.12.2002 by Walter Zorn (Web: http://www.walterzorn.com)
///  Last modified: 2.12.2005
///  Cross-browser tooltips working even in Opera 5 and 6, as well as in NN 4, Gecko-Browsers, IE4+, Opera 7 and Konqueror. No onmouseouts required. Appearance of tooltips can be individually configured via commands within the onmouseovers.
///  LICENSE: LGPL
///  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License (LGPL) as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
///  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
///  For more details on the GNU Lesser General Public License, see http://www.gnu.org/copyleft/lesser.html
/// </summary>

function SetGlobalBrowserVariables ()
{
	try
	{
		if (typeof(GlobalBrowserVariablesSet) == "undefined")
		{
			GlobalBrowserVariablesSet = true;
			Opera = !!(window.opera && document.getElementById);
			Opera6 = Opera && !document.defaultView;
			Opera7 = Opera && !Opera6;
			InternetExplorer = navigator.userAgent.toLowerCase().indexOf("msie") != -1 && document.all && ((document.compatMode && document.compatMode != "BackCompat")? document.documentElement : document.body? document.body : null) && !Opera;
			InternetExplorer6 = InternetExplorer && parseFloat(navigator.appVersion.substring(navigator.appVersion.indexOf("MSIE")+5)) >= 5.5;
			NetscapeNavigator4 = (document.layers && typeof document.classes != "undefined");
			NetscapeNavigator6 = (!Opera && document.defaultView && typeof document.defaultView.getComputedStyle != "undefined");
			W3CCompliant = !InternetExplorer && !NetscapeNavigator6 && !Opera && document.getElementById;
			DocumentBody = (((document.compatMode) && (document.compatMode != "BackCompat")) ? document.documentElement : ((document.body) ? document.body : null));
			PixelSuffix = (Opera6 || NetscapeNavigator4) ? "" : "px";
		}
	}
	catch (ExceptionObject)
	{
	}
}

function GetElement (Id)
{
	if (NetscapeNavigator4)
	{
		return((document.layers[Id] || null));
	}
	else
	{
		if (InternetExplorer)
		{
			return((document.all[Id] || null));
		}
		else
		{
			return((document.getElementById(Id) || null));
		}
	}
}

function ParseInteger (StringValue)
{
	var IntegerValue;
	IntegerValue = parseInt(StringValue);
	if (isNaN(IntegerValue))
	{
		return(0);
	}
	else
	{
		return(IntegerValue);
	}
}

function GetWidth (Tag)
{
	return(ParseInteger(NetscapeNavigator4 ? Tag.clip.width : (Tag.style.pixelWidth || Tag.offsetWidth)));
}

function GetHeight (Tag)
{
	return(ParseInteger(NetscapeNavigator4 ? Tag.clip.height : (Tag.style.pixelHeight || Tag.offsetHeight)));
}

/// <summary>
///  These functions check for the existence of the Macromedia Flash Player and publish Flash content
///  Significant portions of this code are based on the javascript code generated by Macromedia Flash Player
///  and Stearns, G. (2005), "FlashObject v1.2.3: Flash detection and embed", [http://blog.deconcept.com/flashobject/] cited below
///
///  FlashObject v1.2.3: Flash detection and embed - http://blog.deconcept.com/flashobject/
///  FlashObject is (c) 2005 Geoff Stearns and is released under the MIT License:
///  http://www.opensource.org/licenses/mit-license.php
/// </summary>

function DetectFlashPlayer (RequiredVersionMajor)
{
	try
	{
		var DetectedVersionMajor;
		if ((navigator.mimeTypes) && (navigator.mimeTypes["application\/x-shockwave-flash"]))
		{
			if (navigator.mimeTypes["application\/x-shockwave-flash"].enabledPlugin)
			{
				DetectedVersionMajor = ParseInteger(navigator.plugins["Shockwave Flash"].description.replace(/([a-z]|[A-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split(".")[0]);
			}
		}
		else if (window.ActiveXObject)
		{
			var FlashPlayer = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			DetectedVersionMajor = ParseInteger(FlashPlayer.GetVariable("$version").split(" ")[1].split(",")[0]);
		}
		return((DetectedVersionMajor >= RequiredVersionMajor));
	}
	catch (ExceptionObject)
	{
	}
	return(false);
}

function PublishFlashContent (VersionMajor, Id, Width, Height, Movie, ScriptAccess, Quality, BackgroundColor, ShowMenu, FlashVariables, HTMLAlternativeTagId)
{
	var FlashContentHTML = "";
	try
	{
		SetGlobalBrowserVariables();
		if (DetectFlashPlayer(VersionMajor))
		{
			FlashContentHTML += "\<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http:\/\/fpdownload.macromedia.com\/pub\/shockwave\/cabs\/flash\/swflash.cab#version=" + VersionMajor + ",0,0,0\" id=\"" + Id + "\" width=\"" + Width + "\" height=\"" + Height + "\"\>\n";
			FlashContentHTML += " \<param name=\"movie\" value=\"" + Movie + "\" \/\>\n";
			FlashContentHTML += " \<param name=\"allowScriptAccess\" value=\"" + ScriptAccess + "\" \/\>\n";
			FlashContentHTML += " \<param name=\"quality\" value=\"" + Quality + "\" \/\>\n";
			FlashContentHTML += " \<param name=\"bgcolor\" value=\"" + BackgroundColor + "\" \/\>\n";
			FlashContentHTML += " \<param name=\"menu\" value=\"" + ShowMenu + "\" \/\>\n";
			FlashContentHTML += " \<param name=\"wmode\" value=\"opaque\" \/\>\n";
			FlashContentHTML += " \<param name=\"flashvars\" value=\"" + FlashVariables + "\" \/\>\n";
			FlashContentHTML += " \<embed type=\"application\/x-shockwave-flash\" pluginspage=\"http:\/\/www.macromedia.com\/go\/getflashplayer\" id=\"" + Id + "\" name=\"" + Id + "\" width=\"" + Width + "\" height=\"" + Height + "\" src=\"" + Movie + "\" allowScriptAccess=\"" + ScriptAccess + "\" swLiveConnect=\"true\" quality=\"" + Quality + "\" bgcolor=\"" + BackgroundColor + "\" menu=\"" + ShowMenu + "\" wmode=\"opaque\" flashvars=\"" + FlashVariables + "\" \/\>\n";
			FlashContentHTML += "\<\/object\>\n";
			if (typeof(HTMLAlternativeTagId) != "undefined")
			{
				if ((HTMLAlternativeTagId != null) && (HTMLAlternativeTagId != ""))
				{
					var HTMLAlternativeTag = GetElement(HTMLAlternativeTagId);
					if (HTMLAlternativeTag != null)
					{
						HTMLAlternativeTag.innerHTML = FlashContentHTML;
					}
					else
					{
						document.write(FlashContentHTML);
					}
				}
				else
				{
					document.write(FlashContentHTML);
				}
			}
			else
			{
				document.write(FlashContentHTML);
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}
/// <summary>
///  These functions enable drop-down menus
///  Significant portions of this code are based on Koivisto, J. (2004), "KOIVI Nearly Pure CSS Drop-down Menus", KOIVI [http://koivi.com/css-menus/] cited below
///
///  KOIVI Nearly Pure CSS Drop-down Menus (C) 2004 Justin Koivisto
///  Version 3.0
///  Last Modified: 4/27/2005
///  This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
///  This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
///  You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
///  For more details on the GNU Lesser General Public License, see http://www.gnu.org/copyleft/lesser.html
/// </summary>
function ShowRequestedImage ()
{
	try
	{
		if (typeof(ShowRequestedImageInterval) != "undefined")
		{
			if (ShowRequestedImageInterval != null)
			{
				window.clearTimeout(ShowRequestedImageInterval);
				ShowRequestedImageInterval = null;
			}
		}
		RequestedImageTag.src = RequestedImageSourceURL;
	}
	catch (ExceptionObject)
	{
	}
}

function RequestShowImage (ImageTag, ImageSourceURL)
{
	if ((typeof(RequestedImageTag) == "undefined") || (typeof(RequestedImageSourceURL) == "undefined"))
	{
		RequestedImageTag = ImageTag;
		RequestedImageSourceURL = ImageSourceURL;
		ShowRequestedImage();
	}
	else if (RequestedImageTag != ImageTag)
	{
		ShowRequestedImage();
		RequestedImageTag = ImageTag;
		RequestedImageSourceURL = ImageSourceURL;
		ShowRequestedImage();
	}
	else
	{
		RequestedImageTag = ImageTag;
		RequestedImageSourceURL = ImageSourceURL;
		if (typeof(ShowRequestedImageInterval) != "undefined")
		{
			if (ShowRequestedImageInterval != null)
			{
				window.clearTimeout(ShowRequestedImageInterval);
				ShowRequestedImageInterval = null;
			}
		}
		ShowRequestedImageInterval = window.setTimeout(("ShowRequestedImage();"), ShowRequestedImageDelay);
	}
}

function ShowMenu (MenuNodeTag)
{
	try
	{
		if ((MenuNodeTag.MenuNodeImageTag) && (MenuNodeTag.MenuNodeImageTag.RegularSource) && (MenuNodeTag.MenuNodeImageTag.HighlightedSource))
		{
			RequestShowImage(MenuNodeTag.MenuNodeImageTag, MenuNodeTag.MenuNodeImageTag.HighlightedSource);
			MenuNodeTag.className="Active";
		}
		if (InternetExplorer)
		{
			if (MenuNodeTag.MenuChildNodeGroupTag)
			{
				MenuNodeTag.MenuChildNodeGroupTag.style.display = "block";
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}

function HideMenu (MenuNodeTag)
{
	try
	{
		if ((MenuNodeTag.MenuNodeImageTag) && (MenuNodeTag.MenuNodeImageTag.RegularSource) && (MenuNodeTag.MenuNodeImageTag.HighlightedSource))
		{
			RequestShowImage(MenuNodeTag.MenuNodeImageTag, MenuNodeTag.MenuNodeImageTag.RegularSource);
			MenuNodeTag.className="";
		}
		if (InternetExplorer)
		{
			if (MenuNodeTag.MenuChildNodeGroupTag)
			{
 //Add check for Active elements
			 if (MenuNodeTag.className.indexOf("Active") < 0)
			 {
				 MenuNodeTag.MenuChildNodeGroupTag.style.display = "none";
				}
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}

function InitializeMenu (MenuRootNodeGroupTagId)
{
	try
	{
		SetGlobalBrowserVariables();
		if (document.getElementById(MenuRootNodeGroupTagId))
		{
			var MenuRootNodeGroupTag = document.getElementById(MenuRootNodeGroupTagId);
			var MenuNodeTag = MenuRootNodeGroupTag.getElementsByTagName("LI");
			//if (MenuNodeTag.length > 0)
			//{
			//	MenuNodeTag[0].className += " FirstChild";
			//}
			for (var i = 0; i < MenuNodeTag.length; i++)
			{
				var MenuNodeImageTag = MenuNodeTag[i].getElementsByTagName("IMG");
				if (MenuNodeImageTag.length > 0)
				{
					MenuNodeTag[i].MenuNodeImageTag = MenuNodeImageTag[0];
					if (MenuNodeImageTag[0].src.indexOf(MenuHighlightedKeywordExt + ".") == -1)
					{
						MenuNodeTag[i].MenuNodeImageTag.RegularSource = MenuNodeImageTag[0].src;
						MenuNodeTag[i].MenuNodeImageTag.HighlightedSource = MenuNodeImageTag[0].src.substring(0, MenuNodeImageTag[0].src.lastIndexOf(".")) + MenuHighlightedKeyword + ".gif";
					}
				}
				var MenuChildNodeGroupTag = MenuNodeTag[i].getElementsByTagName("UL");
				if (MenuChildNodeGroupTag.length > 0)
				{
					MenuNodeTag[i].MenuChildNodeGroupTag = MenuChildNodeGroupTag[0];
					var MenuChildNodeTag = MenuChildNodeGroupTag[0].getElementsByTagName("LI");
					//if (MenuChildNodeTag.length > 0)
					//{
					//	MenuChildNodeTag[0].className += " FirstChild";
					//}
				}
				MenuNodeTag[i].onmouseover = new Function("ShowMenu(this);");
				MenuNodeTag[i].onmouseout = new Function("HideMenu(this);");
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}


function InitializeMenu (MenuRootNodeGroupTagId,MenuHighlightedKeywordExt)
{
	try
	{
		SetGlobalBrowserVariables();
		if (document.getElementById(MenuRootNodeGroupTagId))
		{
			var MenuRootNodeGroupTag = document.getElementById(MenuRootNodeGroupTagId);
			var MenuNodeTag = MenuRootNodeGroupTag.getElementsByTagName("LI");
			//if (MenuNodeTag.length > 0)
			//{
			//	MenuNodeTag[0].className += " FirstChild";
			//}
			for (var i = 0; i < MenuNodeTag.length; i++)
			{
				var MenuNodeImageTag = MenuNodeTag[i].getElementsByTagName("IMG");
				if (MenuNodeImageTag.length > 0)
				{
					MenuNodeTag[i].MenuNodeImageTag = MenuNodeImageTag[0];
					if (MenuNodeImageTag[0].src.indexOf(MenuHighlightedKeywordExt + ".") == -1)
					{
						MenuNodeTag[i].MenuNodeImageTag.RegularSource = MenuNodeImageTag[0].src;
						MenuNodeTag[i].MenuNodeImageTag.HighlightedSource = MenuNodeImageTag[0].src.substring(0, MenuNodeImageTag[0].src.lastIndexOf(".")) + MenuHighlightedKeywordExt + ".gif";
					}
				}
				var MenuChildNodeGroupTag = MenuNodeTag[i].getElementsByTagName("UL");
				if (MenuChildNodeGroupTag.length > 0)
				{
					MenuNodeTag[i].MenuChildNodeGroupTag = MenuChildNodeGroupTag[0];
					var MenuChildNodeTag = MenuChildNodeGroupTag[0].getElementsByTagName("LI");
					//if (MenuChildNodeTag.length > 0)
					//{
					//	MenuChildNodeTag[0].className += " FirstChild";
					//}
				}
				MenuNodeTag[i].onmouseover = new Function("ShowMenu(this);");
				MenuNodeTag[i].onmouseout = new Function("HideMenu(this);");
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}




/// <summary>
/// <summary>
///  These function parses the DOM and assigns CSS selectors for IE
/// </summary>

function AssignClassNameSuffix (Tag, ClassNameSuffix)
{
	try
	{
		if (typeof(Tag.className) == "undefined")
		{
			Tag.className = ClassNameSuffix;
		}
		else
		{
			Tag.className = Tag.className + " " + ClassNameSuffix;
		}
	}
	catch (ExceptionObject)
	{
	}
}

function AssignCSSSelectors ()
{
	try
	{
		SetGlobalBrowserVariables();
		if (InternetExplorer)
		{
			var ListTag = document.getElementsByTagName("UL");
			var ListFirstChildTag = null;
			var ListLastChildTag = null;
			var ListItemTag = null;
			for (var i = 0; i < ListTag.length; i++)
			{
				ListFirstChildTag = null;
				ListLastChildTag = null;
				if (ListTag[i].hasChildNodes)
				{
					ListItemTag = ListTag[i].childNodes;
					for (var j = 0; j < ListItemTag.length; j++)
					{
						if (ListItemTag[j].tagName.toLowerCase() == "li")
						{
							if (ListFirstChildTag == null)
							{
								ListFirstChildTag = ListItemTag[j];
							}
							ListLastChildTag = ListItemTag[j];
						}
					}
				}
				if (ListFirstChildTag != null)
				{
					AssignClassNameSuffix(ListFirstChildTag, "FirstChild");
					if (ListFirstChildTag != ListLastChildTag)
					{
						AssignClassNameSuffix(ListLastChildTag, "LastChild");
					}
				}
			}
		}
	}
	catch (ExceptionObject)
	{
	}
}

/// <summary>
///  These functions handle events generated by an Input Text box
/// </summary>
function InputTextOnFocusHandler (InputTag, DefaultText)
{
 try
 {
  if (InputTag.value == DefaultText)
  {
   InputTag.value = "";
  }
 }
 catch (ExceptionObject)
 {
 }
}
function InputTextOnBlurHandler (InputTag, DefaultText)
{
 try
 {
  if (InputTag.value == "")
  {
   InputTag.value = DefaultText;
  }
 }
 catch (ExceptionObject)
 {
 }
}

/// <summary>
///  This function Scrolls the page up.
/// </summary>
function pageTop()
{
 try
 {
 window.scrollTo(0,0)
 }
 catch (ExceptionObject)
 {
 }
}

/// <summary>
///  This function Scrolls the page up.
/// </summary>
function pageClose()
{
 try
 {
 window.close();
 }
 catch (ExceptionObject)
 {
 }
}

/// <summary>
///  This function goes back a page from history.
/// </summary>
function pageBack()
{
 try
 {
  history.back();
 }
 catch (ExceptionObject)
 {
 }
}

/// <summary>
///  This function Toggles Display style none or block.
/// </summary>
function Display(Tagid)
{
 try
 {
 var Toggle = document.getElementById(Tagid);
 if (Toggle.style.display == "block")
  {
   Toggle.style.display = "none";
  }
 else
  {
   Toggle.style.display = "block";
  }   
 }
 catch (ExceptionObject)
 {
 }
 return false;
}


/// <summary>
///  This function opens a new window
/// </summary>
function NewWindow(URL)
{
 try
 {
  window.open(URL);
 }
 catch (ExceptionObject)
 {
 }
 return false;
}


/// <summary>
///  This function prints the page
/// </summary>
function pagePrint()
{
 try
 {
  window.print();
 }
 catch (ExceptionObject)
 {
 }
 return false;
}

/// <summary>
///  This function Hides Display
/// </summary>
function Hide(Tagid)
{
 try
 {
  document.getElementById(Tagid).style.display = "none";
 }
 catch (ExceptionObject)
 {
 }
 return false;
}

/// <summary>
///  This function Shows Display
/// </summary>
function Show(Tagid)
{
 try
 {
  document.getElementById(Tagid).style.display = "block";
 }
 catch (ExceptionObject)
 {
 }
 return false;
}

/// <summary>
///  This function opens a centered popup
/// </summary>

function Popup(URL, Width, Height, Scrollable, Resizable)
{
	try
	{
		var Popup;
		if ((typeof(Width) == "number") && (typeof(Height) == "number"))
		{
			Popup = window.open(URL, "Popup", "width = " + Width + ", height = " + Height + ", top = " + ((screen.height - Height) / 2) + ", left = " + ((screen.width - Width) / 2) + ", resizable = " + (Resizable ? "yes" : "no") + ", scrollbars = " + (Scrollable ? "yes" : "no") + ", status = no");
		}
		else
		{
			Popup = window.open(URL, "Popup");
		}
		Popup.window.focus();
	}
	catch (ExceptionObject)
	{
		alert("Your browser or a piece of software installed on your\ncomputer appears to be blocking popups on this page.\n\nPlease enable popups and refresh this page to continue.");
	}
}

/// <summary>
///  Functions used to Assign W3C Compatible Links
///  Portions of this code are based on Kokoska, T. (2003), "Proper way to append to a links onclick handler", thelist [http://lists.evolt.org/archive/Week-of-Mon-20031124/151971.html]
/// </summary>

function AppendOnClickFunction (AnchorTag, Commands)
{
	try
	{
		if (typeof(AnchorTag.onclick) == "function")
		{
			AnchorTag.OnClickFunction = AnchorTag.onclick;
			AnchorTag.onclick = new Function("event", ("this.OnClickFunction();" + Commands));
		}
		else
		{
			AnchorTag.onclick = new Function(Commands);
		}
	}
	catch (ExceptionObject)
	{
	}
}

function AssignLinks ()
{
	try
	{
		var LinkTag = document.getElementsByTagName("A");
		for (var i = 0; i < LinkTag.length; i++)
		{
			if (LinkTag[i].href.indexOf("#") == (LinkTag[i].href.length - 1))
			{
				AppendOnClickFunction(LinkTag[i], "return(false);");
			}
			else if ((typeof(LinkTag[i].rel) != "undefined") && (LinkTag[i].rel.toLowerCase() == "external"))
			{
				AppendOnClickFunction(LinkTag[i], "Popup(this.href);return(false);");
			}
		}
	}
	catch (ExceptionObject)
	{
		alert(ExceptionObject.description);
	}
}
//Added By Bilal
function setOpacity(unit,id)
{
if(document.getElementById("Highlights")!=null)
{
 try
	{
  var object = document.getElementById(id).style;
  object.opacity = (unit/100);
  object.MozOpacity = (unit/100);
  object.KhtmlOpacity = (unit/100);
  object.filter = "alpha(opacity=" + unit + ")";
 }
 catch (ExceptionObject)
 {
 	alert(ExceptionObject.description);
 }
}
}


/// <summary>
///  Functions used to Assign W3C Compatible Links
///  Reference to script http://www.codingforums.com/showthread.php?t=103806
/// </summary>

//function setOpacity(id, opacStart, opacEnd, millisec) 
//{
//	try
//	 {
//   var speed = Math.round(millisec / 100);
//   var timer = 0;
//   if(opacStart > opacEnd) 
//    {
//     for(i = opacStart; i >= opacEnd; i--) 
//      {
//       setTimeout("changeOpacity(" + i + ",'" + id + "')",(timer * speed));
//       timer++;
//      }
//    } 
//   else if(opacStart < opacEnd) 
//    {
//     for(i = opacStart; i <= opacEnd; i++)
//      {
//       setTimeout("changeOpacity(" + i + ",'" + id + "')",(timer * speed));
//       timer++;
//      }
//    }
//  }
//	catch (ExceptionObject)
//	{
//		alert(ExceptionObject.description);
//	}
//}
//function changeOpacity(setOpacity, id) 
//{
//	try
//	 {
//    var object = document.getElementById(id).style;
//    object.opacity = (setOpacity / 100);
//    object.MozOpacity = (setOpacity / 100);
//    object.KhtmlOpacity = (setOpacity / 100);
//    object.filter = "alpha(opacity=" + setOpacity + ")";
//   }
// catch (ExceptionObject)
//	 {
//	 	alert(ExceptionObject.description);
//	 }
//}

/// <summary>
///  Function used to redirect base page from popup window
/// </summary>

function changeURL(URL) 
{
	try
	{
  window.opener.location.href=URL;
 }
 catch (ExceptionObject)
 {
 	alert(ExceptionObject.description);
 }
} 

/// <summary>
///  Function used to handle City selection
/// </summary>
function HandleCity(CityValue)
{
	var OtherCityTextBox = document.getElementById("OtherCity");
	if (CityValue == 'Other')
	{
		OtherCityTextBox.disabled = false;
	}
	else
	{
		OtherCityTextBox.disabled = true;	
	}
	
}


/// <summary>
///  Function for returning how many days there are in a month including leap years
/// </summary>
function DaysInMonth(WhichMonth)
{
  var DaysInMonth = 31;
  if (WhichMonth == "Apr" || WhichMonth == "June" || WhichMonth == "Sep" || WhichMonth == "Nov") DaysInMonth = 30;
  if (WhichMonth == "Feb" )	DaysInMonth = 28;
  return DaysInMonth;
}

/// <summary>
//  Function to change the available days in a months
/// </summary>
function ChangeOptionDays(Which)
{
  DaysObject = document.getElementById('Day')
  
  MonthObject = document.getElementById('Month');

  Month = MonthObject[MonthObject.selectedIndex].text;
  

  DaysForThisSelection = DaysInMonth(Month);
  
  CurrentDaysInSelection = DaysObject.length - 1;
  if (CurrentDaysInSelection > DaysForThisSelection)
  {
    for (i=0; i<(CurrentDaysInSelection-DaysForThisSelection); i++)
    {
      DaysObject.options[DaysObject.options.length - 1] = null
    }
  }
  if (DaysForThisSelection > CurrentDaysInSelection)
  {
    for (i=0; i<(DaysForThisSelection-CurrentDaysInSelection); i++)
    {
      NewOption = new Option(DaysObject.options.length + 1);
      DaysObject.add(NewOption);
    }
  }
    if (DaysObject.selectedIndex < 0) DaysObject.selectedIndex == 0;
}

//Added By Bilal
function ImageReplace(ImageId,ImageName)
{
	try
	{
  document.getElementById(ImageId).src=ImageName;
 }
 catch (ExceptionObject)
 {
 	alert(ExceptionObject.description);
 }
}

/// <summary>
///  Function used to Change Inner Values from a List of given array for any block
/// </summary>

function ReplaceDescription(ObjectId,DescriptionArrayName,DescriptionArrayNumber)
{
	try
	{
	 if (DescriptionArrayNumber>-1)
	 {
   document.getElementById(ObjectId).innerHTML=DescriptionArrayName[DescriptionArrayNumber]
  }
 }
 catch (ExceptionObject)
 {
 	alert(ExceptionObject.description);
 }
}

/// <summary>
///  Function used to reset class name of all child nodes of a given block
/// </summary>
function ResetClassName(myBlockid,myClassName)
{
	try
	{
 var TagElement = document.getElementById(myBlockid);
 for (x=0; x<TagElement.childNodes.length; x++)
  {
   if (TagElement.childNodes[x].className=myClassName)
   {
    TagElement.childNodes[x].className="";
    TagElement.childNodes[0].className="FirstChild";
   }
  }
 }
 catch (ExceptionObject)
 {
 	alert(ExceptionObject.description);
 }
}

//Added From Jeep By Bilal

/// <summary>
///  This function Togles Display from visibility
/// </summary>
function ToggleVisibility(Tagid)
{
 try
 {
 var Toggle = document.getElementById(Tagid);
 if (Toggle.style.visibility == "visible")
  {
   Toggle.style.visibility = "hidden";
  }
 else
  {
   Toggle.style.visibility = "visible";
  }   
 }
 catch (ExceptionObject)
 {
 }
 return false;
}
/// <summary>
///  Function for contact us form
/// </summary>

(function(){
/**
 *@copyriht Copyright (c) 2007 Proximity
 *@author Jerome S. Conde
 *@version 1.0 11:22 AM Monday, January 28, 2008
 */
var Proximity = window.Proximity = function() {};
var userAgent = navigator.userAgent.toLowerCase();
Proximity.prototype = {
	agent : userAgent,
	browser : {
		version: (userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
		safari: /webkit/.test(userAgent),
		opera: /opera/.test(userAgent),
		netscape: /netscape/.test(userAgent),
		msie: /msie/.test(userAgent) && !/opera/.test(userAgent),
		mozilla: /mozilla/.test(userAgent) && !/(compatible|webkit)/.test(userAgent)
	},
	
	getTags : function(oNode,sTag,bImmediate) {
		if(typeof oNode == "object") {
			var tags = oNode.getElementsByTagName(sTag) || [];
			var x = [];
			if(!bImmediate) return tags;
			else{
				for(var i=0,j=tags.length;i<j;i++)
					tags[i].parentNode == oNode ? x.push(tags[i]) : null;
				return x;
			}
		}  
	},
	
	getID : function(sID) {
		x = document; 
		return x.getElementById(sID) ? x.getElementById(sID) : x.all? x.all(sID) : null;
	},
	
	getClass : function(oNode,sClassName) {
		var a = [];
		var re = new RegExp('\\b' + sClassName + '\\b');
		var els = this.getTags(oNode,"*");
		for(var i = 0,j = els.length; i < j; i++)
		if(re.test(els[i].className))a.push(els[i]);
		return a;
	},
	
	addClass : function(oTarget,sClassName) {
		if(typeof oTarget == "object" && !this.getClass(oTarget,sClassName)[0]) {
			oTarget.className += (" " + sClassName);
			return oTarget;
		} else return false;
	},
	
	removeClass : function(oTarget,sClassName) {
		if(typeof oTarget == "object") {
			oTarget.className = oTarget.className.replace(sClassName,"");
			return oTarget;
		} else return false;
	},
	
	toggleClass : function(oTarget,sClassName) {
		if(!this.removeClass(oTarget,sClassName)) this.addClass(oTarget,sClassName);
	},
	
	addEvent : function(obj, type, fn) {
		if ( obj.attachEvent ) {
			obj['e'+type+fn] = fn;
			obj[type+fn] = function(){obj['e'+type+fn]( window.event );}
			obj.attachEvent( 'on'+type, obj[type+fn] );
		} else obj.addEventListener( type, fn, false );
		return obj;
	},
	
	removeEvent : function(obj, type, fn) {
		if ( obj.detachEvent ) {
			obj.detachEvent( 'on'+type, obj[type+fn] );
			obj[type+fn] = null;
		} else obj.removeEventListener( type, fn, false );
		return obj;
	},
	
	getEventTarget: function(x) {
		x = x || window.event;
		return x.target || x.srcElement;
	},
	
	each : function(obj,fn){
		if(typeof obj != "object" && typeof fn != "function") return;
		var thisFn = arguments[2];
		if(obj.length){
			for(var i=0,j=obj.length;i<j;i++){
				fn.call(thisFn,i,obj[i]);
			}
		}
		else{
			for(var prop in obj){
				fn.call(thisFn,prop,obj[prop]);
			}
		}
		return obj;
	},
	
	assignFirstChild : function(sParent,sChild) {
		if(this.browser.msie){
			this.each(this.getTags(document,sParent),function(i,el){
				prox.addClass(prox.getTags(el,sChild)[0],"FirstChild");
			});
		}
	},
	
	assignLastChild : function(sParent,sChild) {
		if(this.browser.msie || this.browser.opera){
			this.each(this.getTags(document,sParent),function(i,el){
				var LIs = prox.getTags(el,sChild,true);
				prox.addClass(LIs[LIs.length-1],"LastChild");
			});
		}
	},
	
	popUp : function(sURL,oSpecs,sName) {
		var options = "";
		for(var y in oSpecs)	options += (y+"="+ oSpecs[y] +",");
		var newWin;
		newWin = window.open(sURL,sName ? sName : "",'"'+options+'"');
		if(window.focus) newWin.focus();
		return false;
	},
	
	externalLinks : function() {
		this.each(this.getTags(document,"A"),function(i,el){
			if(/external/.test(el.rel)) el.target = "_blank"; 
		});
	},
	
	handlers : [],
	registerHandlers : function() {
		this.handlers = arguments;
	},
	executeHandlers : function() {
		var y = this.handlers;
		this.each(y,function(i,el){el();});
	}
}
/*used within the scope of Proximity function*/
var prox = new Proximity; 
/*used outside Proximity*/
window.ip$ = new Proximity;
})();

function contactShowHide(){
 
 var _yes = ip$.getClass(document,'Radio')[0];
 var _no = ip$.getClass(document,'Radio')[1];
 
 _no.onclick = function(){
   //alert('no');
   ip$.getClass(document,'ShowHide')[0].style.visibility = 'hidden';
   ip$.getClass(document,'ShowHide')[1].style.visibility = 'hidden';
   ip$.getClass(document,'ShowHide')[2].style.visibility = 'hidden';
 }
 
 _yes.onclick = function(){
   //alert('no');
   ip$.getClass(document,'ShowHide')[0].style.visibility = 'visible';
   ip$.getClass(document,'ShowHide')[1].style.visibility = 'visible';
   ip$.getClass(document,'ShowHide')[2].style.visibility = 'visible';
 }
}
















