//Local Javascript Functions

//floating menu global vars
// original idea from the Geocities Watermark
// © Nicolas - http://www.javascript-page.com

/* add the following html into your page */
/*
<DIV CLASS="geomark" ID="geomark" 
STYLE="position:absolute;top:1;visibility:hide;" zIndex="1000" ALIGN="right">
      <!--YOUR HTML GOES HERE -->
</DIV>
*/
/* end custom html */




function validateform(strForm) {
//debug
//alert('about to validate form: '+strForm);

//var	name = trimAll(document[strForm].name.value);
var	currEmail = trimAll(document[strForm].ea.value);
var confEmail = trimAll(document[strForm].from_conf.value);


//check that name is valid
/*
if (!validateNotEmpty(name)) {
			alert ('Please enter your name. Thanks.')
			document[strForm].name.focus();
			return false;
		}
*/
//check that email is valid
if (!validateNotEmpty(currEmail)) {
			alert ('Please enter an email address. Thanks.')
			document[strForm].ea.focus();
			return false;
		}
if (validateNotEmpty(currEmail)) {
		if (isEmail(currEmail)== false) {
		
			alert ('The email address has an invalid format. Please try again.')
			document[strForm].ea.focus();
			return false;
		}
	}	
if (currEmail != confEmail) {
			alert ('Email and confirmation email do NOT match. Please correct. Thanks.')
			document[strForm].ea.focus();
			return false;
		}		
		
//Everything OK

//if (isIE) return true;else 
document[strForm].submit();

}//end Validator






function watermark() {
/* previously in main html page */
      myWidth = 0, myHeight = 0; //width and height of browser window
      getScrollXY(); //gets scrollbar x,y offsets scrOfY,scrOfX
      getWinSize();
      
      
      image_width = 164; //width of watermark area
      image_height = 378; //height of watermark area
      left_from_corner = myWidth-image_width-27; //placement relative to scroll bar
      up_from_corner = 115; //placement upward relative to the horiz scroll bar
      var header_height =110;
      //alert (myHeight);
      //determine diff between win height and header+body+footer
      var minHeight = image_height+header_height+up_from_corner
      var floatdiff = myHeight - minHeight
      //alert (floatdiff);
      if (myHeight < minHeight) {
          
          if (scrOfY > (header_height) ){
              //alert(scrOfY);
                up_from_corner =((myHeight - header_height)-image_height ) ;
              }else {
                up_from_corner=85;
              }
       }
      //alert("up: "+up_from_corner+" scrOfY: "+scrOfY);
      


      JH = 0;
      JW = 0;
      JX = 0;
      JY = 0;
      left = image_width + left_from_corner + 17;
      up = image_height + up_from_corner + 15;
/* end old global vars */

 if(navigator.appName == "Netscape") {
   JH = window.innerHeight
   JW = window.innerWidth
   JX = window.pageXOffset
   JY = window.pageYOffset
   wm.visibility = "hide"
   wm.top = (JH+JY-up)
   wm.left = (JW+JX-left)
   wm.visibility= "show"
 }

 if (navigator.appVersion.indexOf("MSIE") != -1){
  if (navigator.appVersion.indexOf("Mac") == -1){
   wm.style.display = "none";
   JH = document.body.clientHeight;
   JW = document.body.clientWidth;
   JX = document.body.scrollLeft;
   JY = document.body.scrollTop;
   wm.style.top = (JH+JY-up);
   wm.style.left =(JW+JX-left);
   wm.style.display = "";
  }
 }
}

function msover(){
    window.status = window_says
    return true;
}

function msout(){
    window.status = ""
    return true;
}


//END GEOCITIES WATERMARK FUNCTION

// BEGIN MENU IMAGE CONTROL
if (document.images) {
        menu1on = new Image();
        menu1on.src = "images/entr_solutions_over.gif";
        menu1off = new Image();
        menu1off.src = "images/entr_solutions.gif";
        menu2on = new Image();
        menu2on.src = "images/exec_solutions_over.gif";
        menu2off = new Image();
        menu2off.src = "images/exec_solutions.gif";
        menu3on = new Image();
        menu3on.src = "images/case_studies_over.gif";
        menu3off = new Image();
        menu3off.src = "images/case_studies.gif";
        menu4on = new Image();
        menu4on.src = "images/subscribe_over.gif";
        menu4off = new Image();
        menu4off.src = "images/subscribe.gif";
        menu5on = new Image();
        menu5on.src = "images/articles_over.gif";
        menu5off = new Image();
        menu5off.src = "images/articles.gif";
        menu6on = new Image();
        menu6on.src = "images/resources_over.gif";
        menu6off = new Image();
        menu6off.src = "images/resources.gif";

        menu61on = new Image();
        menu61on.src = "images/media_over.gif";
        menu61off = new Image();
        menu61off.src = "images/media.gif";

        menu7on = new Image();
        menu7on.src = "images/about_over.gif";
        menu7off = new Image();
        menu7off.src = "images/about.gif";
        menu8on = new Image();
        menu8on.src = "images/contact_over.gif";
        menu8off = new Image();
        menu8off.src = "images/contact.gif";
        menu9on = new Image();
        menu9on.src = "images/home_over.gif";
        menu9off = new Image();
        menu9off.src = "images/home.gif";
	menu10on = new Image();
        menu10on.src = "images/speaking_over.gif";
        menu10off = new Image();
        menu10off.src = "images/speaking.gif";
}
function img_act(imgName) {
     if (document.images) {
             imgOn = eval(imgName + "on.src");
             document [imgName].src = imgOn;
     }
}

function img_inact(imgName) {
     if (document.images) {
             imgOff = eval(imgName + "off.src");
             document [imgName].src = imgOff;
     }
}
//END MENU IMAGE CONTROL



function emailFriend() { 
var href =  (escape(window.location.href));
//alert (href);
emailWindow = 
window.open('http://borgesonconsulting.com/email_friend.asp?geturl=' + href, 
'emailWin', 
'top=30,screeny=30,left=30,screenx=30,width=620,height=600,resizable=yes,scrollbars=no'); 
emailWindow.focus();
 }


//Security
function validategetpass(strForm) {
//validate appropriate fields for password lookup
    var	user_id = trimAll(document[strForm].user_id.value)

    //check that email is valid
    if (!validateNotEmpty(user_id)) {
    			alert ('Please Enter Your User ID. Thanks.')
    			document[strForm].user_id.focus();
    			return false;
    		}
    /*
    if (validateNotEmpty(currEmail)) {
    		if (isEmail(currEmail)== false) {
    		
    			alert ('The Email Address Has An Invalid Format. Please Try Again')
    			document[strForm].user_id.focus();
    			return false;
    		}
    	}	
    */

    document[strForm].blngetpass.value='1'; //turn on the password lookupfield
    document[strForm].submit();
    return true;
}

function validatelogin(strForm) {
var	user_id = trimAll(document[strForm].user_id.value)
var	password = trimAll(document[strForm].password.value)


//check that email is valid
if (!validateNotEmpty(user_id)) {
			alert ('Please Enter A User ID. Thanks.')
			document[strForm].user_id.focus();
			return false;
		}


//check that password is OK
if (!validateNotEmpty(password)) {
			alert ('Please Enter A Password. Thanks.')
			document[strForm].password.focus();
			return false;
		}
		
//ensure password is 6 to 15 characters
		var strLen = password.length;
		if (strLen < 6 || strLen > 15) {
		  alert ('Password Must be Between 6 and 15 Characters.');
		  document[strForm].password.focus();
			return false;
		}
		 
document[strForm].submit();
}//end Validator





function img_act(imgName) {
     if (document.images) {
             imgOn = eval(imgName + "on.src");
             document [imgName].src = imgOn;
     }
}

function img_inact(imgName) {
     if (document.images) {
             imgOff = eval(imgName + "off.src");
             document [imgName].src = imgOff;
     }
}

function dsplyItinerary(event_id){
  //called when 
  var page2call = '/content/c_event_itin.asp?id='+event_id;
 	objWin = window.open(page2call, 'Itinerary', 'width=600,height=500,scrollbars=yes,resizable=yes,toolbar=yes,menubar=no');
	objWin.focus();
	}
	
function dsplyDirections(event_id){
  //called when 
  var page2call = '/content/c_event_directions.asp?id='+event_id;
 	objWin = window.open(page2call, 'Directions', 'width=600,height=500,scrollbars=yes,resizable=yes,toolbar=yes,menubar=no');
	objWin.focus();
	}	
function dsplyEvent_Reminder(event_id){
  //called when 
  
  //var page2call = '/content/event_reminder.asp?id='+event_id;
  
  //objWin = window.open(page2call, 'Reminder', 'width=10,height=10,scrollbars=no,resizable=no,toolbar=no,menubar=no'); 
	//objWin.focus();
	
	location.href = '/content/event_reminder.asp?id='+event_id;
}

function dsplyEvent_Reminder_pop(event_id){
  //called when 
  var pop_page2call = '/content/event_reminder_pop.asp?id='+event_id;
  
  //open pop up window with instructions
 	objWin_pop = window.open(pop_page2call, 'Event_Reminder', 'width=250,height=175,scrollbars=no,resizable=yes,toolbar=no,menubar=no');
  
	objWin_pop.focus();
}		


function MM_CheckFlashVersion(reqVerStr,msg){
  with(navigator){
    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
    if (!isIE || !isWin){  
      var flashVer = -1;
      if (plugins && plugins.length > 0){
        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
        if (desc == "") flashVer = -1;
        else{
          var descArr = desc.split(" ");
          var tempArrMajor = descArr[2].split(".");
          var verMajor = tempArrMajor[0];
          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
          flashVer =  parseFloat(verMajor + "." + verMinor);
        }
      }
      // WebTV has Flash Player 4 or lower -- too low for video
      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;

      var verArr = reqVerStr.split(",");
      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);
  
      if (flashVer < reqVer){
        if (confirm(msg))
          window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
      }
    }
  } 
}
