function adChanged(checkbox)
{
	if(checkbox.checked){
		//alert('check');
		document.getElementById('recruitmentSource2Input').style.display='';
	}
	else
	{
		//alert('uncheck');		
		document.getElementById('recruitmentSource2Input').style.display='none';
	}
}

function changeDay(id){
	var weekDays = new Array('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun');
	var obj;
	for(i in weekDays)
	{
		obj = getObject(weekDays[i]);
		if(obj!=null)
			obj.style.display = 'none';
	}
	obj = getObject(id);
	if(obj!=null)
		obj.style.display = '';
	changeMenuDay(id);
}

function changeMenuDay(id){
	var weekDays = new Array('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun');
	var obj;
	for(i in weekDays)
	{
		obj = getObject(weekDays[i]+'MenuOn');
		if(obj!=null)
			obj.style.display = 'none';
		obj = getObject(weekDays[i]+'MenuOff');
		if(obj!=null)
			obj.style.display = '';
	}
	obj = getObject(id+'MenuOn');
	if(obj!=null)
		obj.style.display = '';
	obj = getObject(id+'MenuOff');
	if(obj!=null)
		obj.style.display = 'none';
}

function printWindow() {if (document.all||document.getElementById) {window.print();}} //display print dialog

//get browser info in order to detect if the browser supports filters and if the browser is IE 5.0 (if 5.0 requires the hiding of select boxes)
function csBrowserInfo()
{
	var csUserAgent = String(navigator.userAgent);
	if (!document.getElementById) return -1;
	else if(csUserAgent.indexOf("MSIE 5") > -1) return 0;
	else if(csUserAgent.indexOf("Opera") > -1) return 1;
	else if(csUserAgent.indexOf("MSIE 6") > -1) return 2;
	else if(csUserAgent.indexOf("MSIE 7") > -1) return 2;
	else if(csUserAgent.indexOf("Netscape6") > -1) return 3;
	else if(csUserAgent.indexOf("Netscape") > -1) return 4;
	else if(csUserAgent.indexOf("Firefox") > -1) return 5;
	else return 1;
}

//hide selects for ie 5.0 since the iframe hack does not work
function hideSelects(action) {
	var numberForms = document.forms.length;
	for (formIndex = 0; formIndex < numberForms; formIndex++)
	{
	   var numberElems; numberElems = document.forms[formIndex].elements.length
	   for (formElemIndex = 0; formElemIndex < numberElems; formElemIndex++)
		{
		   if (document.forms[formIndex].elements[formElemIndex].tagName=='SELECT') {
			document.forms[formIndex].elements[formElemIndex].style.visibility=action;
		   }
		}
	}
}

//função para simular submit de botões da aplicação - retirar após lançamento
function doSubmit(url) {
	document.forms[0].action=url;document.forms[0].method="get";document.forms[0].submit();
}
//função geral de mesagens - apagar esta função após lançamento
function message(type){
	if (type==0){alert("Não Disponível");}
	else if (type==1){alert("Funcionalidade de Ordenar\nLista pela coluna\nseleccionada");}
}
//função geral que retorna referência a um objecto por id
function getObject(id) {
	if (document.all){return(document.all(id))}
	if (document.getElementById){return(document.getElementById(id))}
}

//this function writes an iframe used to hide form elements that would otherwise show up through a html layer
var iframe; //reference to the frame object
var browser = String(navigator.userAgent);
//writeFrame(); //write the frame to the browser			//PJCLARO 20060322 Prevents Javascript error on Posting create
function writeFrame() {
	if (iframe!=true) {
		//alert(browser+csBrowserInfo())
		if (csBrowserInfo()!=1 && csBrowserInfo()!=0) {
		document.write("<iframe id=\"iframe\" style=\"display: none; width:0px; height:0px; left:0px; position:absolute; top: 0px; z-index:1000;\" src=\"javascript:false;\" frameBorder=\"1\" scrolling=\"no\"></iframe>")
		iframe = document.getElementById("iframe");
		}
	}
}

// retornam a posição de um objecto no ecrã

function getRealTop(obj){var curtop = 0;if (obj.offsetParent) {while (obj.offsetParent){curtop += obj.offsetTop;obj = obj.offsetParent;}} else if (obj.y) curtop += obj.y; return curtop;}
function getRealLeft(xobj){var curleft = 0;if (xobj.offsetParent) {while (xobj.offsetParent){curleft += xobj.offsetLeft;xobj = xobj.offsetParent;}} else if (xobj.x) curleft += xobj.x; return curleft;}
function getHeight(objID) {return objID.offsetHeight}
function getWidth(objID) {return objID.offsetWidth}

//capture mouse position for quick help functionality
var xpos, ypos;
if (document.layers) document.captureEvents(Event.MOUSEMOVE);
document.onmousemove=getMouseCoordinates;

function getMouseCoordinates(e) {
	if (!e) var e = window.event;
	if (e.pageX || e.pageY) {xpos = e.pageX;ypos = e.pageY;}
	else if (e.clientX || e.clientY){xpos = e.clientX + document.body.scrollLeft;ypos = e.clientY + document.body.scrollTop;}
	// xpos and ypos contain the mouse position relative to the document
}

// buscar altura de scroll da página
function getScrollY() {
  scrOfY = 0;
  if( typeof( window.pageYOffset ) == 'number' ) {scrOfY = window.pageYOffset;} //Netscape compliant
  else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {scrOfY = document.body.scrollTop;}//DOM compliant
  else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {scrOfY = document.documentElement.scrollTop;}//IE6 standards compliant mode
  return(scrOfY);
}

// buscar tamanho da janela de browser
function windowSize(type) {
	var wWidth, wHeight;
	if( typeof( window.innerWidth ) == 'number' ) {wWidth = window.innerWidth;wHeight = window.innerHeight;}//Non-IE
  	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {wWidth = document.documentElement.clientWidth;wHeight = document.documentElement.clientHeight;}//IE 6+ in 'standards compliant mode'
  	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {wWidth = document.body.clientWidth;wHeight = document.body.clientHeight;}//IE 4 compatible
	if(type=="w"){return(wWidth);}else{return(wHeight);}
}

function screenWidth(){
	return(screen.width);
}

// pop-up windows
function popUpWindow(URLStr, windowSettings) 
{
	var popUpWin;
	var width = 865;
	if (windowSettings=='virtualtour') {
		if (screenWidth()<801) {width=600}
		windowSettings='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height=465,top=100,left=100,screenX=100,screenY=100';
		if (URLStr=='') {URLStr = "virtualtour.aspx";}
	} else {
		windowSettings='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=540,height=390,top=100,left=100,screenX=100,screenY=100';
	}
	if(popUpWin) {if(!popUpWin.closed) popUpWin.close();}popUpWin = open(URLStr, 'popUpWin', windowSettings);
}

//generic pop window funtion that accepts window settings and url parameters
//if no window settings defaults to set small pop-up window
function popUpWindowFlash(URLStr, windowSettings) {
var popUpWin;
if (windowSettings=='flash'){windowSettings='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width=550,height=310,top=100,left=100,screenX=100,screenY=100'}
if(popUpWin) {if(!popUpWin.closed) popUpWin.close();}popUpWin = open(URLStr, 'popUpWin', windowSettings);
}

//show/hide highlites
var timer;
var iframetimer;
var toHide;
var yOffset = 3;
var xOffset = -1;
function showHighlite(id) {

	var sender = getObject("Highlights_"+id+"_img");
	var layer = getObject(id+"_highlite");
	
	var top = getRealTop(sender)-getHeight(layer)+yOffset+"px";
	var left = getRealLeft(sender)+xOffset+"px";
	
	if(timer){clearTimeout(timer);} // clear timers
	if ((layer.style.top=="-2000px")||(layer.style.top=="")) {
		if(iframetimer){clearTimeout(iframetimer);} // clear timers
		hideHighliteNow() //hide any visible layer
		if (csBrowserInfo()==0) {hideSelects('hidden');} //hide selects on page for ie5/5.5
		if (csBrowserInfo()==2) {//if i.e 6 then place layer transition effects
			layer.style.display='none';
			layer.style.top = top;
			layer.style.left = left;
			layer.style.filter = "progid:DXImageTransform.Microsoft.RevealTrans(transition=4, duration=0.2)";layer.filters.item(0).enabled=1;layer.filters.item(0).apply(); //apply the filter only if this is the first time the meun is shown
			layer.style.display='block';
			layer.filters.item(0).play();
			iframetimer = setTimeout("placeIframe('"+id+"')",200);
		} else if (csBrowserInfo()==3) {
			layer.style.display='none';
			layer.style.top = top;
			layer.style.left = left;
			layer.style.display='block';
		} else {
			layer.style.top = top;
			layer.style.left = left;
			placeIframe(id)
		}
		toHide=layer; //set the layer to hide as the layer that was shown
	}
}
function hideHighlite() {timer = setTimeout("hideHighliteNow()",500)}
function hideHighliteNow() {
	if(toHide){
		if (iframe) {iframe.style.top = '0px';iframe.style.left = '0px';iframe.style.width = '0px';iframe.style.height = '0px';iframe.style.display = 'none';}
		toHide.style.top="-2000px";toHide.style.left="-2000px";
		if (csBrowserInfo()==0) {hideSelects('visible');}
		toHide = null;
	}
}
function placeIframe(id) {
	var layer = getObject(id+"_highlite");
	if (iframe) {iframe.style.top=getRealTop(layer)+3+"px";iframe.style.left=layer.style.left;iframe.style.width=getWidth(layer);iframe.style.height=getHeight(layer)-3+"px";iframe.style.display='';layer.style.zIndex=2000;}
}

// mostrar tool tip
function showTip(id){
	var obj = getObject(id); var left; var top;
	if((xpos+4+125)>windowSize("w")) {left = xpos-100-15;} else {left = xpos+4;} //correct for tool tips going off screen
//PJC20060411	if( typeof( window.innerWidth ) == 'number' ){top=ypos+12;} else {top=getScrollY()+ypos+12;} //if non ie no need to allow for scroll
	top=ypos+12;
	if (obj) {obj.style.left=left+'px';obj.style.top=top+'px';if (obj.style.display!='block'){obj.style.display='block';}}
}
function hideTip(id) {
	if (iframe) {iframe.style.top = '0px';iframe.style.left = '0px';iframe.style.width = '0px';iframe.style.height = '0px';iframe.style.display = 'none';}
	getObject(id).style.display="none";
}

function zoomIn() {
	var mapIn = getObject('In_Image'); var mapOut = getObject('Out_Image'); var mapDefault = getObject('Default_Image');
	if ((mapDefault.style.display=='block')||(mapDefault.style.display=='')) {
		mapOut.style.display='none';mapDefault.style.display='none';mapIn.style.display='block';
	} else if (mapOut.style.display=='block') {
		mapIn.style.display='none';mapOut.style.display='none';mapDefault.style.display='block';
	}
}

function zoomOut() {
	var mapIn = getObject('In_Image'); var mapOut = getObject('Out_Image'); var mapDefault = getObject('Default_Image');
	if ((mapDefault.style.display=='block')||(mapDefault.style.display=='')) {
		mapDefault.style.display='none';mapIn.style.display='none';mapOut.style.display='block';
	} else if (mapIn.style.display=='block') {
		mapIn.style.display='none';mapOut.style.display='none';mapDefault.style.display='block';
	}
}

function doVirtualTour(id) {
	var combo = getObject(id);
	var URL = "clubs/" + combo[combo.selectedIndex].value + "/virtualtour.aspx";
	popUpWindow(URL, "virtualtour");
}

function doInscricao(id) {
	var combo = getObject(id);
	var URL = "clubs/" + combo[combo.selectedIndex].value + "/inscricao.aspx";
	window.location=URL;
}

function onClubCheck(){
	var clientCheck = document.getElementById('UCLoader1_uc_trainingacademy_form_socio')
	var clubSelect = document.getElementById('UCLoader1_uc_trainingacademy_form_clubSelect')

	if(clubSelect!=null && clientCheck!=null)
	{
		if(clientCheck.checked)
		{
			clubSelect.disabled = false;
		}
		else
		{
			clubSelect.selectedIndex = 0;
			clubSelect.disabled = true;
		}
	}
}

function input_onkeypress(ev)
{
    var evt = ev ? ev : window.event;
    var elem, key, kchar;
    if (evt) 
    {
		elem = evt.target ? evt.target : evt.srcElement;
		key = evt.keyCode ? evt.keyCode : evt.which;
		kchar =(typeof evt.charCode != "undefined") ? evt.charCode : evt.keyCode;
	}

	if ( void 0==elem ) return true;

	var accepted = true;
	
	accepted = acceptOnlyNumbers(evt, elem, kchar, false);
	
	return accepted;
}


function replaceKey(evt,elem,kchar)
{
	if (evt.preventDefault)
	{
		evt.preventDefault();
		triggerKeyEvent (elem, "keypress", kchar, true, false, false, false, false );
	}
	else
	{
		// IE
		evt.keyCode = kchar;
	}
}

function cancelKey(evt)
{
	if (evt.preventDefault)
	{
		// W3C DOM
		evt.preventDefault();
		evt.stopPropagation();
	}
	else
	{
		// IE
		evt.keyCode = 0;
		evt.returnValue = false;
	}
}

function acceptOnlyNumbers (evt, elem, kchar, allowDecimalPoint)
{
	var ret = false;
	
	if ( kchar==0 ) 
	{
		//FF 
		ret = true;
	}
	else if ( kchar==Keys.TAB || kchar==Keys.ESC || kchar==Keys.BACKSPACE || kchar>63000 )
	{
		//Safari TAB,Shift+TAB,backspace,delete
		ret = true;
	}
	else if ( kchar==Keys.Enter ) ret=true;
	else if ( kchar>=Keys.n0 && kchar<= Keys.n9 ) ret=true;
	else if ( kchar==46 || kchar==44 )
	{
		if ( elem.value.indexOf(",") < 0 )	// Only allows one ','
		{
			ret = true;
			if (kchar == 46)
			{
				// replace '.'=46 with ','=44
				replaceKey(evt, elem, 44);
			}
		}
	}
		
	if (!ret)
	{
		cancelKey(evt);
	}
		
	return ret;
}

var Keys =
{
   BACKSPACE : 8, TAB : 9, 
   NUMPADCLEAR : 12, ENTER : 13, 
   SHIFT : 16, CTRL : 17, ALT : 18, PAUSE : 19, CAPS : 20, 
   ESC : 27, 
   SPACEBAR : 32, PAGEUP : 33, PAGEDN : 34, END : 35, HOME : 36, LEFT : 37, UP : 38, RIGHT : 39, DOWN : 40, 
   PRTSC : 44, INSERT : 45, DELETE : 46,
   n0 : 48, n1 : 49, n2 : 50, n3 : 51, n4 : 52, n5 : 53, n6 : 54, n7 : 55, n8 : 56, n9 : 57,
   SEMICOLON : 59,
   A : 65, B : 66, C : 67, D : 68, E : 68, F : 70, G : 71, H : 72, I : 73, J : 74, K : 75,
   L : 76, M : 77, N : 78, O : 79, P : 80, Q : 81, R : 82, S : 83, T : 84, U : 85, V : 86,
   W : 87, X : 88, Y : 89, Z : 90,
   WINLEFT : 91, WINRIGHT : 92, SELECT : 93, 
   NUM0 : 96, NUM1 : 97, NUM2 : 98, NUM3 : 99, NUM4 : 100, NUM5 : 101, 
   NUM6 : 102, NUM7 : 103, NUM8 : 104, NUM9 : 105, MULTIPLY : 106, ADD : 107, 
   SUBTRACT : 109, DECIMAL : 110, DIVIDE : 111, 
   F1 : 112, F2 : 113, F3 : 114, F4 : 115, F5 : 116, F6 : 117, F7 : 118, F8 : 119, F9 : 120, F10 : 121, F11 : 122, F12 : 123, 
   NUMLOCK : 144, SCROLLLOCK : 145,
   SEMICOLON : 186, EQUAL : 187, COMMA : 188, DASH : 189, PERIOD : 190, FORWARDSLASH : 191, GRAVEACCENT : 192,
   OPENBRACKET : 219, BACKSLASH : 220, CLOSEBRACKET : 221, QUOTE : 222
};

function popUpWindowImg(URLStr, position){
	var popUpWin;	
	if (position=="H"){
		width=640;
		height=480;
	}
	if (position=="V"){
		width=480;
		height=640;
	}
	windowSettings='toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',top=100,left=100,screenX=100,screenY=100';	
	if(popUpWin) {if(!popUpWin.closed) popUpWin.close();}popUpWin = open(URLStr, 'popUpWin', windowSettings);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Código - Use.it                                                                                                            //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//******************************* Tabs ******************************* 

//writes the iframe for ie browsers in order to cover up window objects
function initializeMenu() {
	browser = csBrowserInfo();
	if (browser>3) {brwY=-1;brwX=0;} else {brwY=0;brwX=1;}
	if (iframe!=true && browser < 7 && browser >1 ) {
		document.write("<iframe id=\"iframe\" style=\"display: none; width:0px; height:0px; left:0px; position:absolute; top: 0px; z-index:1000;\" src=\"javascript:;\" frameBorder=\"0\"  scrolling=\"no\"></iframe>")
		iframe = document.getElementById("iframe");
	}
}

function UseItgetObject(id) {
	if (document.all) {	if (document.all(id)) {return(document.all(id));}if (document.all('op_menu_' + id)) {return(document.all('op_menu_' + id));}}
	if (document.getElementById) {if (document.getElementById(id)) {return(document.getElementById(id));}if (document.getElementById('op_menu_' + id)) {return(document.getElementById('op_menu_' + id));}}
}

var timer; //will hold the timer object
var xOffset=0; // pixel offset to the left
var yOffset=1; // pixel offset to the left
var iframe; //reference to the frame object
var selectArray; //will hold the selects on page
var disableHide = false;

function UseIthideOneClick(strhideOneClick)
	{
		if(timer){clearTimeout(timer);}
		
		switch(strhideOneClick) {
				case "Content1":
		            if (UseItgetObject('Content2').style.display='') {UseIthideNow('Content2');}
		            if (UseItgetObject('Content3').style.display='') {UseIthideNow('Content3');}
					timer = setTimeout("UseIthideNow('Content1')",500);
				break
				case "Content2":
				    if (UseItgetObject('Content1').style.display='') {UseIthideNow('Content1');}
		            if (UseItgetObject('Content3').style.display='') {UseIthideNow('Content3');}
					timer = setTimeout("UseIthideNow('Content2')",500);
				break
				case "Content3":
				    if (UseItgetObject('Content1').style.display='') {UseIthideNow('Content1');}
		            if (UseItgetObject('Content2').style.display='') {UseIthideNow('Content2');}
		            if (disableHide == true){timer = setTimeout("UseIthideNow('Content3')",10000);}
					if (disableHide == false){timer = setTimeout("UseIthideNow('Content3')",500);}
				break
			}
	}
	
function UseItshowOneClick(SelectedTab, strItemToShowNow) {if (timer) {clearTimeout(timer);} UseItshowNow(SelectedTab, strItemToShowNow);} //if mouse over menu then clear the hide timer
function UseItSelectClick() {disableHide = true;}

function UseItshowClick(strshowClick) { var mobj; mobj = UseItgetObject(strshowClick); if (timer) {clearTimeout(timer);} if(mobj && mobj.style.display=='block') { UseIthideNow(strshowClick); } else { UseItshowNow(strshowClick); } }

function UseItshowNow(SelectedTab, ItemToShowNow) {
	
	switch(ItemToShowNow) {
				case "Content1":
		            if (UseItgetObject('Content2').style.display='') {UseIthideNow('Content2');}
		            if (UseItgetObject('Content3').style.display='') {UseIthideNow('Content3');}
				break
				case "Content2":
				    if (UseItgetObject('Content1').style.display='') {UseIthideNow('Content1');}
		            if (UseItgetObject('Content3').style.display='') {UseIthideNow('Content3');}
				break
				case "Content3":
				    if (UseItgetObject('Content1').style.display='') {UseIthideNow('Content1');}
		            if (UseItgetObject('Content2').style.display='') {UseIthideNow('Content2');}
				break
			}
	
	
	var mobj; mobj = UseItgetObject(ItemToShowNow);
	var sender = document.getElementById(SelectedTab.id);
	//var sender; sender = UseItgetObject('sender' + ItemToShowNow);
	var browser;
	
	if(mobj && mobj.style.display!='block') {
		if (UseItcsBrowserInfo()==0) {UseIthideSelects('hidden');}
		if (UseItcsBrowserInfo()==2){mobj.style.filter = "progid:DXImageTransform.Microsoft.RevealTrans(transition=1, duration=0.1)";mobj.filters.item(0).enabled=1;mobj.filters.item(0).apply();} //apply the filter only if this is the first time the meun is shown
		mobj.style.display='block'; //show the selected menu
		mobj.style.left = UseItgetRealLeft(sender)+UseItgetWidth(sender)-UseItgetWidth(mobj)+xOffset+'px' //the the left point of the menu
		mobj.style.top = UseItgetRealTop(sender)+UseItgetHeight(sender)+yOffset+'px'; //set the top point of the menu
		mobj.style.display=''; //redraw for opera bug
		mobj.style.display='block';
		if (UseItcsBrowserInfo()==2){mobj.filters.item(0).play();} //run apllied filter if the browser is internet explorer 6.0+
		if (iframe) {iframe.style.top=mobj.style.top;iframe.style.left=mobj.style.left;iframe.style.width=UseItgetWidth(mobj);iframe.style.height=UseItgetHeight(mobj)-5;iframe.style.display='';mobj.style.zIndex=2000;}
	} else {
	
	}
}

function UseIthideNow(ItemToHideNow) { 
    var mobj;
    mobj = UseItgetObject(ItemToHideNow);
    //alert(ItemToHideNow);
    if (mobj) {setTimeout(mobj.style.display='',500);} /* hide the active menu */
    if (iframe) {iframe.style.top = '0px';iframe.style.left = '0px';iframe.style.width = '0px';iframe.style.height = '0px';iframe.style.display = 'none';}
    if (UseItcsBrowserInfo()==0) {UseIthideSelects('visible');}
    disableHide = false;
    }

// these functions return the x,y,width and height of an object
function UseItgetRealLeft(obj){var curleft = 0;if (obj.offsetParent) {while (obj.offsetParent){curleft += obj.offsetLeft;obj = obj.offsetParent;}} else if (obj.x) curleft += obj.x; return curleft;}
function UseItgetRealTop(obj){var curtop = 0;if (obj.offsetParent) {while (obj.offsetParent){curtop += obj.offsetTop;obj = obj.offsetParent;}} else if (obj.y) curtop += obj.y; return curtop;}
function UseItgetHeight(objID) {return objID.offsetHeight}
function UseItgetWidth(objID) {return objID.offsetWidth}

//get browser info in order to detect if the browser supports filters and if the browser is IE 5.0 (if 5.0 requires the hiding of select boxes)
function UseItcsBrowserInfo()
{
	var csUserAgent = String(navigator.userAgent);
	if (!document.getElementById) return -1;
	else if(csUserAgent.indexOf("MSIE 5.0") > -1) return 0;
	else if(csUserAgent.indexOf("Opera") > -1) return 1;
	else if(csUserAgent.indexOf("MSIE 6") > -1) return 2;
	else if(csUserAgent.indexOf("MSIE 7") > -1) return 2;
	else return 1;
}

//hide selects for ie 5.0 since the iframe hack does not work
function UseIthideSelects(action) {	var numberForms = document.forms.length; for (formIndex = 0; formIndex < numberForms; formIndex++) {
	   var numberElems; numberElems = document.forms[formIndex].elements.length
	   for (formElemIndex = 0; formElemIndex < numberElems; formElemIndex++)
		{if (document.forms[formIndex].elements[formElemIndex].tagName=='SELECT') {
			document.forms[formIndex].elements[formElemIndex].style.visibility=action; } } } }


//******************************* SWFObject ******************************* 

if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){if(!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;},getSWFHTML:function(){var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();return true;
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){this.major=_27[0]!=null?parseInt(_27[0]):0;this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[2]):0;};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;} if(this.major>fv.major){return true;} if(this.minor<fv.minor){return false;} if(this.minor>fv.minor){return true;} if(this.rev<fv.rev){
return false; }return true; };
deconcept.util={getRequestParameter:function(_29){
var q=document.location.search||document.location.hash;
if(q){var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all){return;}
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){_2d[i].style.display="none";for(var x in _2d[i]){
if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};
deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};
__flash_savedUnloadHandler=function(){};
if(typeof window.onunload=="function"){
var _30=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();_30();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}};
if(typeof window.onbeforeunload=="function"){
var oldBeforeUnload=window.onbeforeunload; window.onbeforeunload=function(){ deconcept.SWFObjectUtil.prepUnload(); oldBeforeUnload(); }; }else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;}
if(Array.prototype.push==null){ 
Array.prototype.push=function(_31){ this[this.length]=_31; return this.length; }; } var getQueryParamValue=deconcept.util.getRequestParameter; var FlashObject=deconcept.SWFObject; var SWFObject=deconcept.SWFObject;

//******************************* Scroller AJAX *******************************

////Ajax related settings
var csbustcachevar=0 //bust potential caching of external pages after initial Ajax request? (1=yes, 0=no)
var csloadstatustext="<img src='/hp/images/new/widgets/loading.gif' alt='Loading'/> Requesting content..." //HTML to indicate Ajax page is being fetched
var csexternalfiles=[] //External .css or .js files to load to style the external content(s), if any. Separate multiple files with comma ie: ["cat.css", dog.js"]

////NO NEED TO EDIT BELOW////////////////////////
var enablepersist=true
var slidernodes=new Object() //Object array to store references to each content slider's DIV containers (<div class="contentdiv">)
var csloadedobjects="" //Variable to store file names of .js/.css files already loaded (if Ajax is used)

function ContentSlider(sliderid, autorun, customPaginateText, customNextText){
	var slider=document.getElementById(sliderid)
	if (typeof customPaginateText!="undefined" && customPaginateText!="") //Custom array of pagination links text defined?
		slider.paginateText=customPaginateText
	if (typeof customNextText!="undefined" && customNextText!="") //Custom HTML for "Next" link defined?
		slider.nextText=customNextText
	slidernodes[sliderid]=[] //Array to store references to this content slider's DIV containers (<div class="contentdiv">)
	ContentSlider.loadobjects(csexternalfiles) //Load external .js and .css files, if any
	var alldivs=slider.getElementsByTagName("div")
	for (var i=0; i<alldivs.length; i++){
		if (alldivs[i].className=="contentdiv"){
			slidernodes[sliderid].push(alldivs[i]) //add this DIV reference to array
			if (typeof alldivs[i].getAttribute("rel")=="string") //If get this DIV's content via Ajax (rel attr contains path to external page)
				ContentSlider.ajaxpage(alldivs[i].getAttribute("rel"), alldivs[i])
		}
	}
	ContentSlider.buildpagination(sliderid)
	var loadfirstcontent=true
	if (enablepersist && getCookie(sliderid)!=""){ //if enablepersist is true and cookie contains corresponding value for slider
		var cookieval=getCookie(sliderid).split(":") //process cookie value ([sliderid, int_pagenumber (div content to jump to)]
		if (document.getElementById(cookieval[0])!=null && typeof slidernodes[sliderid][cookieval[1]]!="undefined"){ //check cookie value for validity
			ContentSlider.turnpage(cookieval[0], parseInt(cookieval[1])) //restore content slider's last shown DIV
			loadfirstcontent=false
		}
	}
	if (loadfirstcontent==true) //if enablepersist is false, or cookie value doesn't contain valid value for some reason (ie: user modified the structure of the HTML)
		ContentSlider.turnpage(sliderid, 0) //Display first DIV within slider
	if (typeof autorun=="number" && autorun>0) //if autorun parameter (int_miliseconds) is defined, fire auto run sequence
		window[sliderid+"timer"]=setTimeout(function(){ContentSlider.autoturnpage(sliderid, autorun)}, autorun)
}

ContentSlider.buildpagination=function(sliderid){
	var slider=document.getElementById(sliderid)
	var paginatediv=document.getElementById("paginate-"+sliderid) //reference corresponding pagination DIV for slider
	var pcontent="<div style='display:none;'>"
	for (var i=0; i<slidernodes[sliderid].length; i++){ //For each DIV within slider, generate a pagination link
		pcontent+='<a href="#" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', '+i+'); return false\">'+(slider.paginateText? slider.paginateText[i] : i+1)+'</a> '
	}
	pcontent +="</div>";
	pcontent+='<a href="#" onClick=\"ContentSlider.turnpage(\''+sliderid+'\', parseInt(this.getAttribute(\'rel\'))); return false\"><img src=\"/hp/images/new/btns/btn_next.gif\" alt=\"Mais\" /></a><img class=\"imgTitle\" src=\"/hp/images/new/widgets/spacer.gif\" alt=\"\" />';
	paginatediv.innerHTML=pcontent
	paginatediv.onclick=function(){ //cancel auto run sequence (if defined) when user clicks on pagination DIV
	if (typeof window[sliderid+"timer"]!="undefined")
		clearTimeout(window[sliderid+"timer"])
	}
}

ContentSlider.turnpage=function(sliderid, thepage){

	var paginatelinks=document.getElementById("paginate-"+sliderid).getElementsByTagName("a") //gather pagination links
	
	for (var i=0; i<slidernodes[sliderid].length; i++){ //For each DIV within slider
		//paginatelinks[i].className="" //empty corresponding pagination link's class name
		slidernodes[sliderid][i].style.display="none" //hide DIV
	}
	//paginatelinks[thepage].className="selected" //for selected DIV, set corresponding pagination link's class name
	slidernodes[sliderid][thepage].style.display="block" //show selected DIV
	//Set "Next" pagination link's (last link within pagination DIV) "rel" attribute to the next DIV number to show
	paginatelinks[paginatelinks.length-1].setAttribute("rel", thenextpage=(thepage<paginatelinks.length-2)? thepage+1 : 0)
	if (enablepersist)
		setCookie(sliderid, sliderid+":"+thepage)
}

ContentSlider.autoturnpage=function(sliderid, autorunperiod){
	var paginatelinks=document.getElementById("paginate-"+sliderid).getElementsByTagName("a") //Get pagination links
	var nextpagenumber=parseInt(paginatelinks[paginatelinks.length-1].getAttribute("rel")) //Get page number of next DIV to show
	ContentSlider.turnpage(sliderid, nextpagenumber) //Show that DIV
	window[sliderid+"timer"]=setTimeout(function(){ContentSlider.autoturnpage(sliderid, autorunperiod)}, autorunperiod)
}

function getCookie(Name){ 
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
}

function setCookie(name, value){
	document.cookie = name+"="+value
}

////////////////Ajax Related functions //////////////////////////////////

ContentSlider.ajaxpage=function(url, thediv){
	var page_request = false
	var bustcacheparameter=""
	if (window.XMLHttpRequest) // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
	else if (window.ActiveXObject){ // if IE
		try {
		page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
		try{
		page_request = new ActiveXObject("Microsoft.XMLHTTP")
		}
		catch (e){}
		}
	}
	else
		return false
	thediv.innerHTML=csloadstatustext
	page_request.onreadystatechange=function(){
		ContentSlider.loadpage(page_request, thediv)
	}
	if (csbustcachevar) //if bust caching of external page
		bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
	page_request.open('GET', url+bustcacheparameter, true)
	page_request.send(null)
}

ContentSlider.loadpage=function(page_request, thediv){
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
		thediv.innerHTML=page_request.responseText
}

ContentSlider.loadobjects=function(externalfiles){ //function to load external .js and .css files. Parameter accepts a list of external files to load (array)
	for (var i=0; i<externalfiles.length; i++){
		var file=externalfiles[i]
		var fileref=""
		if (csloadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
			if (file.indexOf(".js")!=-1){ //If object is a js file
				fileref=document.createElement('script')
				fileref.setAttribute("type","text/javascript");
				fileref.setAttribute("src", file);
			}
			else if (file.indexOf(".css")!=-1){ //If object is a css file
				fileref=document.createElement("link")
				fileref.setAttribute("rel", "stylesheet");
				fileref.setAttribute("type", "text/css");
				fileref.setAttribute("href", file);
			}
		}
		if (fileref!=""){
			document.getElementsByTagName("head").item(0).appendChild(fileref)
			csloadedobjects+=file+" " //Remember this object as being already added to page
		}
	}
}

//******************************* destaques ******************************

    function checkObj(prefix,imgTimeout, nObj){
        fnStartInterval(prefix, nObj, imgTimeout, 0);
    }
    
    function fnStartInterval(prefix, nObj, imgTimeout, currentImageIdx){
        doTrans(prefix, nObj, imgTimeout, currentImageIdx);
    }
    
    function doTrans(prefix, nObj, imgTimeout, currentImageIdx){
        for (e=1;e<=nObj;e++){
            hObj = getObject(prefix+e);
            if (hObj){
            hObj.style.top = -100000 + 'px';
            //alert(prefix+e);
            }
        }
        if (currentImageIdx < nObj){currentImageIdx++}
        else {currentImageIdx = 1}
        //alert(cObj);
        objName = getObject(prefix + currentImageIdx);
        objName.style.top = 19 + 'px';
        setTimeout("fnStartInterval('" +prefix+ "'," + nObj+ "," + imgTimeout+ "," + currentImageIdx +")",imgTimeout);
    }
    
    nObja = 0;
    cObja = 0;
    tObja = 0;
    function checkObja(prefix,pObj){
        for (ia=1;ia<15;ia++){
            objNamea = prefix+ia;
            if(getObject(objNamea)){
                nObja++;
            }
        }
        //alert(nObj);
        tObja = pObj;
        fnStartIntervala(prefix);
    }
    
    function fnStartIntervala(prefix){
        //alert(cObj);
        doTransa(prefix);
    }
    
    function doTransa(prefix){
        for (ea=1;ea<=nObja;ea++){
            hObja = getObject(prefix+ea);
            if (hObja){
            hObja.style.top = -100000 + 'px';
            //alert(prefix+e);
            }
        }
        if (cObja < nObja){cObja++}
        else {cObja = 1}
        //alert(cObj);
        objNamea = getObject(prefix + cObja);
        objNamea.style.top = 19 + 'px';
        setTimeout("fnStartIntervala('"+prefix+"')",tObja);
    }


//******************************* Calculadoras ******************************

function looseFocus(id) {
    getObject(id).blur()
}

function calcularCalorias(){
	
	//--- valor inicial de calorias
	calorias=0;	
	//---  correr
	if(isNaN(document.Form1.correr.value) || document.Form1.correr.value<0){
		 //este valor não será contabilizado
	}else{
		calorias += 0.133*document.Form1.correr.value*document.Form1.peso.value;
	}
	//---  pescar
	if(isNaN(document.Form1.pescar.value) || document.Form1.pescar.value<0){
		 //este valor não será contabilizado
	}else{
		calorias+=0.066*document.Form1.pescar.value*document.Form1.peso.value;
	}
	//---  aeróbica
	if(isNaN(document.Form1.aerobica.value) || document.Form1.aerobica.value<0){
		 //este valor não será contabilizado
	}else{
		calorias+=0.100*document.Form1.aerobica.value*document.Form1.peso.value;
	}
	//---  nadar
	if(isNaN(document.Form1.nadar.value) || document.Form1.nadar.value<0){
		 //este valor não será contabilizado
	}else{
		calorias+=0.100*document.Form1.nadar.value*document.Form1.peso.value;
	}
	//---  andar
	if(isNaN(document.Form1.andar.value) || document.Form1.andar.value<0){
		 //este valor não será contabilizado
	}else{
		calorias+=0.058*document.Form1.andar.value*document.Form1.peso.value;
	}
	//---  dançar
	if(isNaN(document.Form1.dancar.value) || document.Form1.dancar.value<0){
		 //este valor não será contabilizado
	}else{
		calorias+=0.075*document.Form1.dancar.value*document.Form1.peso.value;
	}
	//---  jardinagem
	if(isNaN(document.Form1.jardinagem.value) || document.Form1.jardinagem.value<0){
		 //este valor não será contabilizado
	}else{
		calorias+=0.083*document.Form1.jardinagem.value*document.Form1.peso.value;
	}
	//---  ténis
	if(isNaN(document.Form1.tenis.value) || document.Form1.tenis.value<0){
		 //este valor não será contabilizado
	}else{
		calorias+=0.117*document.Form1.tenis.value*document.Form1.peso.value;
	}
	//---  cozinhar
	if(isNaN(document.Form1.cozinhar.value) || document.Form1.cozinhar.value<0){
		 //este valor não será contabilizado
	}else{
		calorias+=0.042*document.Form1.cozinhar.value*document.Form1.peso.value;
	}
	//---  pedalar
	if(isNaN(document.Form1.pedalar.value) || document.Form1.pedalar.value<0){
		 //este valor não será contabilizado
	}else{
		calorias+=0.083*document.Form1.pedalar.value*document.Form1.peso.value;
	}
	//---  futebol
	if(isNaN(document.Form1.futebol.value) || document.Form1.futebol.value<0){
		 //este valor não será contabilizado
	}else{
		calorias+=0.117*document.Form1.futebol.value*document.Form1.peso.value;
	}
	//---  limpezas
	if(isNaN(document.Form1.limpezas.value) || document.Form1.limpezas.value<0){
		 //este valor não será contabilizado
	}else{
		calorias+=0.058*document.Form1.limpezas.value*document.Form1.peso.value;
	}
	//--- retornar valor para a caixa de texto										
	document.Form1.calorias_consumidas.value = calorias;	
	return false;
	
}

function calcularCoracao(altura, peso){
		
	coracao = peso/(altura/100)/(altura/100);
	document.Form1.estado_coracao.value = coracao;
	if (coracao < 18.5){
		document.getElementById("1-1").style.display="";
		document.getElementById("2-1").style.display="none";
		document.getElementById("3-1").style.display="none";
		document.getElementById("4-1").style.display="none";
		document.getElementById("1").className="on";
		document.getElementById("2").className="";
		document.getElementById("3").className="";
		document.getElementById("4").className="";
		document.getElementById("1").style.fontWeight="bold";
		document.getElementById("2").style.fontWeight="normal";
		document.getElementById("3").style.fontWeight="normal";
		document.getElementById("4").style.fontWeight="normal";
	}
	if (coracao >= 18.5 && coracao < 25){
		document.getElementById("1-1").style.display="none";
		document.getElementById("2-1").style.display="";
		document.getElementById("3-1").style.display="none";
		document.getElementById("4-1").style.display="none";
		document.getElementById("1").className="";
		document.getElementById("2").className="on";
		document.getElementById("3").className="";
		document.getElementById("4").className="";
		document.getElementById("1").style.fontWeight="normal";
		document.getElementById("2").style.fontWeight="bold";
		document.getElementById("3").style.fontWeight="normal";
		document.getElementById("4").style.fontWeight="normal";
	}
	if (coracao >= 25 && coracao < 30){
		document.getElementById("1-1").style.display="none";
		document.getElementById("2-1").style.display="none";
		document.getElementById("3-1").style.display="";
		document.getElementById("4-1").style.display="none";
		document.getElementById("1").className="";
		document.getElementById("2").className="";
		document.getElementById("3").className="on";
		document.getElementById("4").className="";
		document.getElementById("1").style.fontWeight="normal";
		document.getElementById("2").style.fontWeight="normal";
		document.getElementById("3").style.fontWeight="bold";
		document.getElementById("4").style.fontWeight="normal";
	}
	if (coracao >= 30){
		document.getElementById("1-1").style.display="none";
		document.getElementById("2-1").style.display="none";
		document.getElementById("3-1").style.display="none";
		document.getElementById("4-1").style.display="";
		document.getElementById("1").className="";
		document.getElementById("2").className="";
		document.getElementById("3").className="";
		document.getElementById("4").className="on";
		document.getElementById("1").style.fontWeight="normal";
		document.getElementById("2").style.fontWeight="normal";
		document.getElementById("3").style.fontWeight="normal";
		document.getElementById("4").style.fontWeight="bold";
	}	
	document.getElementById("resultado").style.display="";
	return false;
	
}

function calcularPeso(altura){
				if (document.Form1.sexo['0'].checked){
					peso = (50000 + (900 * (altura - (152 + (4/10)))))/1000;
				}
				if (document.Form1.sexo['1'].checked){
					peso = (49000 + (669 * (altura - (152 + (4/10)))))/1000;
				}
				document.Form1.peso_ideal.value = Math.round(peso*10)/10 ;		
	}

function loadMap(lat,lng) {
	if (GBrowserIsCompatible()) {
		//var intLat = 38.713757;
		var intLat = lat;
		//var intLng = -9.231064;
		var intLng = lng;
		var map = new GMap2(document.getElementById("divLocalizacao"));
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
		map.setCenter(new GLatLng(intLat, intLng), 16);
		
		// Create our "tiny" marker icon
		var icon = new GIcon();
		icon.image = "http://www.holmesplace.pt/hp/Testes/images/Icon.png";
		icon.shadow = "http://www.holmesplace.pt/hp/Testes/images/Icon_Shadow.png";
		icon.iconSize = new GSize(27, 18);
		icon.shadowSize = new GSize(27, 18);

		icon.iconAnchor = new GPoint(6, 20);
		icon.infoWindowAnchor = new GPoint(5, 1)
				
		var point = new GLatLng(intLat,intLng);
		map.addOverlay(new GMarker(point, icon));
	}
}
/**
 *	Date Validation
 */
// Declaring valid date character, minimum year and maximum year
var dtCh= "/";
var minYear=1900;
var maxYear=2100;

function isInteger(s){
	var i;
    for (i = 0; i < s.length; i++){   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function stripCharsInBag(s, bag){
	var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function daysInFebruary (year){
	// February has 29 days in any year evenly divisible by four,
    // EXCEPT for centurial years which are not also divisible by 400.
    return (((year % 4 == 0) && ( (!(year % 100 == 0)) || (year % 400 == 0))) ? 29 : 28 );
}
function DaysArray(n) {
	for (var i = 1; i <= n; i++) {
		this[i] = 31
		if (i==4 || i==6 || i==9 || i==11) {this[i] = 30}
		if (i==2) {this[i] = 29}
   } 
   return this
}

function isDate(dtStr){
	var daysInMonth = DaysArray(12)
	var pos1=dtStr.indexOf(dtCh)
	var pos2=dtStr.indexOf(dtCh,pos1+1)
	var strMonth=dtStr.substring(0,pos1)
	var strDay=dtStr.substring(pos1+1,pos2)
	var strYear=dtStr.substring(pos2+1)
	strYr=strYear
	if (strDay.charAt(0)=="0" && strDay.length>1) strDay=strDay.substring(1)
	if (strMonth.charAt(0)=="0" && strMonth.length>1) strMonth=strMonth.substring(1)
	for (var i = 1; i <= 3; i++) {
		if (strYr.charAt(0)=="0" && strYr.length>1) strYr=strYr.substring(1)
	}
	month=parseInt(strMonth)
	day=parseInt(strDay)
	year=parseInt(strYr)
	if (pos1==-1 || pos2==-1){
		//alert("The date format should be : mm/dd/yyyy")
		return false
	}
	if (strMonth.length<1 || month<1 || month>12){
		//alert("Please enter a valid month")
		return false
	}
	if (strDay.length<1 || day<1 || day>31 || (month==2 && day>daysInFebruary(year)) || day > daysInMonth[month]){
		//alert("Please enter a valid day")
		return false
	}
	if (strYear.length != 4 || year==0 || year<minYear || year>maxYear){
		//alert("Please enter a valid 4 digit year between "+minYear+" and "+maxYear)
		return false
	}
	if (dtStr.indexOf(dtCh,pos2+1)!=-1 || isInteger(stripCharsInBag(dtStr, dtCh))==false){
		//alert("Please enter a valid date")
		return false
	}
return true
}
/*------------------------------------------*/

var isFormSubmited = false;

function _validateFormSubmission ( source, args )
{
	var ret = true;
	
	ValidatorUpdateIsValid();
	if (Page_IsValid)
	{
		if ( !isFormSubmited )  { isFormSubmited = true; }
		else 
		{ 
			// disable summaries
			
			for (var sums = 0; sums < Page_ValidationSummaries.length; sums++) 
			{
				summary = Page_ValidationSummaries[sums];
				summary.showsummary = "False";
			}
			
			ret = false; 
		}	
	}
	
	args.IsValid = ret;
}
