﻿
// enable disableRefresh in CRM
document.onkeydown = disableRefresh;

/* Disable refresh in CRM
Disables F5, CTRL+R, CTRL+N, CTRL+T in otder to prevent from
resubmitting forms and data when just wanting to refresh page
(prevents multiple submissions of data by mistake)
*/
function disableRefresh(e) {
    var key, isCTRL;
    if (window.event) // IE
    {
        key = window.event.keyCode;
        isCTRL = window.event.ctrlKey;
    }
    else if (e.which) // Netscape/Firefox/Opera
    {
        key = e.which;
        isCTRL = e.ctrlKey;
    }

    if (key == 116 /*F5*/ || (isCTRL && key == 82) /*CTRL+R*/ || (isCTRL && key == 78) /*CTRL+N*/ || (isCTRL && key == 84) /*CTRL+T*/) {
        if (window.event) {
            //IE
            window.event.keyCode = 0;
            window.event.returnValue = false;
        }
        else //Firefox
            e.preventDefault();
    }
    else {
        //alert(key);
    }
}

var defaultEmptyOK = false
var whitespace = " \t\n\r";			// whitespace characters

function RenderPhoneValidationByClick(e) {

    var key;
    if (window.event) // IE
    {
        key = e.keyCode;
    }
    else if (e.which) // Netscape/Firefox/Opera
    {
        key = e.which;
    }

    //alert(key);
    // Key 8 - Backspace
    // Key 17 - Ctrl
    // Key 107 - + Sign
    // Key 9 - Tab
    // Key 46 - Delete
    // Key 111 - / Sign
    // Key 32 - Space
    // Key 188 - Comma
    // Key 16 - Shift
    // Key 189 - Dash 
    // Key 35 - Home
    // Key 36 - End
    // Keys 48-57 and 97-105 - Numeric Digits
    if ((key < 48 || key > 57) && (key < 95 || key > 105) && (key != 8) && (key != 46) && (key != 111) && (key != 32) && (key != 37) && (key != 35) && (key != 36) && (key != 39) && (key != 188) && (key != 189) && (key != 16) && (key != 9) && (key != 107)) {
        if (window.event) //IE
            window.event.returnValue = false;
        else //Firefox
            e.preventDefault();

    }
}


function ChangeCountryCode(formName, countryCodeFieldNamesStr, stateCodeFieldNamesStr) {
    var CountryID, objCode, CountryCode, objField;
    var arrcCountryCodeFieldNames = new Array();
    var arrcStateCodeFieldNames = new Array();
    var i = 0;
    arrcCountryCodeFieldNames = countryCodeFieldNamesStr.split(',');
    arrcStateCodeFieldNames = stateCodeFieldNamesStr.split(',');

    CountryID = document.getElementById("CountryID").value;
    // deal with selection of ~~~~~~~~~~~~ line in list
    if (CountryID == "-2") {
        //document.Registration.CountryID.selectedIndex = 0;
        //CountryID = document.Registration.CountryID.value;
    }
    objCode = document.getElementById("CountryCode" + CountryID);

    // deal with duplicated countries in list
    if (objCode.length > 0) {
        objCode = objCode[0];
    }
    if (objCode != null) {
        // deal with objCode eval call failiure
        if (objCode.value != undefined) {
            CountryCode = objCode.value;
        }
        else {
            CountryCode = "";
        }


        if (CountryCode.length > 0) {
            CountryCode = "+" + CountryCode;
        }
        else {
            CountryCode = "";
        }

        if (CountryCode == "+1" || CountryCode == "+61" || CountryCode == "+7") {
            // USA - Enabled StateCode Box
            for (i = 0; i < arrcStateCodeFieldNames.length; i++) {
                objField = document.getElementById(arrcStateCodeFieldNames[i]);
                if (objField != null) {
                    objField.style.display = "block";
                }
            }
        }
        else {
            // Not USA - Disable StateCode Box
            for (i = 0; i < arrcStateCodeFieldNames.length; i++) {
                objField = document.getElementById(arrcStateCodeFieldNames[i]);
                if (objField != null) {
                    objField.style.display = "none";
                }
            }
        }

        for (i = 0; i < arrcCountryCodeFieldNames.length; i++) {
            objField = document.getElementById(arrcCountryCodeFieldNames[i]);
            if (objField != null) {
                objField.value = CountryCode;
            }
        }
    }

}
  
  
function changeImage(ImagesRoot,ImgName,Newsrc,OnOrOff)
{
	var obj;
	Newsrc = ImagesRoot + '/' + Newsrc + '_' + OnOrOff + '.gif';
	obj = eval("document.all." + ImgName);
	obj.src = Newsrc;
}

function isEmpty(s)
{	return ((s == null) || (s.length == 0) || (isEmptySpaces(s)) || isWhitespace(s));
}
function isEmptySpaces(s)
{	var i ;
	var cond=true ;
	
	for (i=0 ; i<s.length ; i++)
		if (!(s.charAt(i)==" "))

			cond=false ;
	return cond ;	
}

function isInteger (s)
{   var i;
    if (isEmpty(s)) 
       return false
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);

        if (!isDigit(c)) return false;
    }    
    return true;
}

function isFloat (s)
{   var i;
	var dot=false ;
	
    if (isEmpty(s)) 
       return false;
    for (i = 0; i < s.length; i++)
    {   
        var c = s.charAt(i);
		if (c=='.') 
		{	if (dot)
				return false ;
			else
				dot=true ;				
		};
        if (!isDigit(c) && c!='.') return false;
    }    
    return true;
}

function isLetter (c)
{   return ( ((c >= "a") && (c <= "z")) || ((c >= "A") && (c <= "Z")) )
}

function isSmallLetter (c)
{   return ((c >= "a") && (c <= "z"))
}

function isBigLetter (c)
{   return ((c >= "A") && (c <= "Z"))
}

function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}

function isLetterOrDigit (c)
{   return (isLetter(c) || isDigit(c))
}

function isWhitespace (s)
{   var i;
    for (i = 0; i < s.length; i++)
    {           
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) return false;
    }
    return true;
}

function addToErrMsg(errMsg,addToMsg){	
	errMsg=errMsg+addToMsg + "\n";
	return errMsg;
}

function isValidPassword(s)
{
	var isValid=true;
	if (s.length<4){
		return false;		
	}
	/*else
	{   for (i = 0; i < s.length; i++)
		{   			
			var c = s.charAt(i);
			if (! isLetterOrDigit (c) )
				return false;
		}
	} 
	*/
    return true;
}

function isValidPhone(s)
{
	var isValid=true;
	if (s.length<6){
		return false;
	}
	else
	{	for (i=0; i<s.length; i++)
		{
			var c = s.charAt(i);
			if ( !isDigit(c) )
				return false;
		}
	}
	return true;
}



function isEmail(s)
{   if (isEmpty(s)) 
       if (isEmail.arguments.length == 1) return defaultEmptyOK;
       else return (isEmail.arguments[1] == true);
   
    if (isWhitespace(s)) return false;
    var i = 1;
    var sLength = s.length;
    
    while ((i < sLength) && (s.charAt(i) != "@"))
		i++ ;

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;
    
    while ((i < sLength) && (s.charAt(i) != "."))
		i++ ;
    
    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}

function UpdateHiddenOfDatePicker(tDate,frmName,dayInputName,monthInputName,yearInputName){
	var dd,mm,yyyy,index1, index2;
	index1 = tDate.indexOf('/',0);
	dd = tDate.substr(0,index1);
	index2 = tDate.indexOf('/',index1+1);
	mm = tDate.substr(index1+1,index2-index1-1);
	yyyy = tDate.substr(index2+1,4);
			
	if (index1>2 || index1==0 || index2<3 || index2>5 || isNaN(dd)  || isNaN(mm) || isNaN(yyyy)){
		alert("Invalid date format\nDate format: dd/mm/yyyy");
	}
	else if(dd>31 || dd<1 || mm<1 || mm>12 || yyyy<2000 || yyyy>2020){
		alert("Wrong date");
	}
	else
	{
		eval('document.'+frmName+'.'+dayInputName+'.value=dd');
		eval('document.'+frmName+'.'+monthInputName+'.value=mm');
		eval('document.'+frmName+'.'+yearInputName+'.value=yyyy');
	}			
}
function openDialog(src,myWidth,myHeight)
{	var winSTR,myWin;
	winSTR = "toolbar=no,address=no,status=no,scrollbars=1,resizable=1,alwayRaised=yes,width=" + myWidth + ",height=" + myHeight; 
	myWin = window.open(src,"dialogWin",winSTR);
}

function OpenHelpWindow(src,width,height,moreProperties,moveX,moveY)
{
		var sourceURL,winSTR,myWin;
		sourceURL=src;
		winSTR = 'toolbar=no,address=no,status=no,resizeable=yes,alwayRaised=yes,width='+width+',height='+height+moreProperties;
		myWin = window.open(sourceURL,'HelpWindow',winSTR);
		
		myWin.moveTo(moveX,moveY);	
		myWin.focus();
}
function openPopup(sourceURL,width,height)
{					
	winSTR = 'scrollbars=yes,toolbar=no,address=no,status=no,resizable=yes,alwayRaised=yes,width='+width+',height='+height;
	myWin = window.open(sourceURL,'',winSTR);		
}
function openCenteredPopup(sourceURL,width,height)
{					
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	winSTR = 'toolbar=no,address=no,status=no,resizable=yes,alwayRaised=yes,width='+width+',height='+height+',left=' + winl + ',top=' + wint;
	myWin = window.open(sourceURL,'',winSTR);		
}
function openCenteredPopupWithScroll(sourceURL,width,height)
{					
	var winl = (screen.width - width) / 2;
	var wint = (screen.height - height) / 2;
	winSTR = 'scrollbars=yes,toolbar=no,address=no,status=no,resizable=yes,alwayRaised=yes,width='+width+',height='+height+',left=' + winl + ',top=' + wint;
	myWin = window.open(sourceURL,'',winSTR);		
}
function openPopupWithScroll(sourceURL,width,height)
{					
	winSTR = 'scrollbars=yes,toolbar=no,address=no,status=no,resizable=yes,alwayRaised=yes,width='+width+',height='+height;
	myWin = window.open(sourceURL,'',winSTR);
}
function openPopupWithStatus(sourceURL, width, height) {
    winSTR = 'scrollbars=yes,toolbar=no,address=no,status=yes,resizable=yes,alwayRaised=yes,width=' + width + ',height=' + height;
    myWin = window.open(sourceURL, '', winSTR);
}
function CheckForillegalCharacters(FormName,FieldName,MsgErrorName)
{
	var obj;
	var oneChar;
	obj = eval("document." + FormName + "." + FieldName + ".value");
	if (obj.length>0){
			for (i=0; i<obj.length; i++)
			{
				oneChar = obj.charAt(i);
				if (oneChar == '<' || 
					oneChar == '>' || 
					oneChar == '|' || 
					oneChar == ';' || 
					oneChar == '/' || 
					oneChar == '\\' ||
					oneChar == '\'' ||  
					oneChar == '&' ||  
					oneChar == '"' ||
					oneChar == '*' ||
					oneChar == ','
					)
				{	
					AddError(MsgErrorName); 
					break;
				}
			}
		}
}
function CheckForillegalCharactersNoSpaces(FormName,FieldName,MsgErrorName)
{
	var obj;
	var oneChar;
	obj = eval("document." + FormName + "." + FieldName + ".value");
	if (obj.length>0){
			for (i=0; i<obj.length; i++)
			{
				oneChar = obj.charAt(i);
				if (oneChar == '<' || 
					oneChar == '>' || 
					oneChar == '|' || 
					oneChar == ';' || 
					oneChar == '/' || 
					oneChar == '\\' ||
					oneChar == '\'' ||  
					oneChar == '&' ||  
					oneChar == '"' ||
					oneChar == '*' ||
					oneChar == ',' ||
					oneChar == ' '
					)
				{	
					AddError(MsgErrorName); 
					break;
				}
			}
		}
}

function CheckForOnlyHebrewCharacters(FormName,FieldName,MsgErrorName)
{
	var obj;
	var oneChar;
	obj = eval("document." + FormName + "." + FieldName + ".value");
	if (obj.length>0){
			for (i=0; i<obj.length; i++)
			{
				oneChar = obj.charAt(i);
				if ((oneChar < "א" || oneChar > "ת") && oneChar!= " " && oneChar!= "-")
				{	
					AddError(MsgErrorName); 
					break;
				}
			}
		}
}

function pickRandomNumber(range) 
{
	if (Math.random)
	{
		return Math.round(Math.random() * (range-1));
	}	
	else 
	{
		var now = new Date();
		return (now.getTime() / 1000) % range;
	}
}

function AddToFav()
{
	var bookmarkurl = window.location.href;
    var bookmarktitle = document.title;
    if (document.all) 
    {
		window.external.AddFavorite(bookmarkurl,bookmarktitle);
    }
}

function AddToFavoritesWithURLAndDesc(url,desc)
{
	 var bookmarkurl = url;
	 var bookmarktitle = desc;
	  if (document.all) 
	  {
	window.external.AddFavorite(bookmarkurl,bookmarktitle);
	  }
}

function PreloadImages() 
{
  if (document.images) 
  {
    if (typeof(document.WM) == 'undefined')
    {
      document.WM = new Object();
    }
    document.WM.loadedImages = new Array();
    // Loop through all the arguments.
    var argLength = PreloadImages.arguments.length;
    for(arg=0;arg<argLength;arg++) 
    {
      // For each arg, create a new image.
      document.WM.loadedImages[arg] = new Image();
      // Then set the source of that image to the current argument.
      document.WM.loadedImages[arg].src = PreloadImages.arguments[arg];
    }
  }
}

//if exists retun item 	
function findItemInArray(Item, Arr)
{
	for (var i=0;i<Arr.length;i++)
	{
		if (Arr[i]==Item)
		{
			return Item;
		}
	}
		
	return null;
}


function RenderMasterSlave(FormName, masterObj, SlaveObj,initialName,initialValue,UniqueId)
		{

		    
		    var obj, GroupIDs, Temp, counter, SlaveNames, SlaveIDs, SlaveMasterIDs, MasterIDs;
			// get form object
			obj = eval("document." + FormName);
			
			// get master and slave objects
			masterObj = eval("document." + FormName + "." +masterObj );
			SlaveObj = eval("document." + FormName + "." + SlaveObj);
			
			// get arrays
			SlaveNames = eval("SlaveNames"+UniqueId );
			SlaveIDs = eval("SlaveIDs"+UniqueId );
			SlaveMasterIDs = eval("SlaveMasterIDs"+UniqueId );
			
			Temp="";
			MasterIDs=""; // holds the selected value(s)
			
			// check if master object allows multiple choise
			if ((masterObj.multiple==true) || (masterObj.multiple==""))
			{
				// if so, save all of the selected values
				for (var i=0;i<masterObj.length;i++)
				{
					if(masterObj[i].selected ==true)
					  {
					  	MasterIDs =MasterIDs+ Temp+masterObj[i].value;
					  	Temp=",";
					  	
					  }	
				}
			}	
			else
			{
				// save the single selected value
				MasterIDs = masterObj.value;
			}


	
			
			//no groups were chosen
			if (MasterIDs=="") return;
			
			
			// split string list
			MasterIDs = MasterIDs.split(",");

			
			SlaveObj.options.length = 0
			
			counter=0;		
			if ((initialName!="") ||(initialValue!=""))
			{
				// default select value
				var opt =  new Option();
				opt.value=initialValue ;
				opt.name=initialName ;
				opt.text=initialName ;
				SlaveObj.options[counter++] = opt;
			}

			
			for (i=0;i<SlaveIDs.length;i++)
			{
				if (findItemInArray(SlaveMasterIDs[i], MasterIDs)==SlaveMasterIDs[i])
				{
				    
						var opt =  new Option();
						opt.value=SlaveIDs[i] ;
						opt.name=SlaveNames[i] ;
						opt.text=SlaveNames[i] ;					
						SlaveObj.options[counter++] = opt;
				}
			}
		
	}
	
function Hierarchy_ShowHide(parentLevel, level, id) {
    var obj = document.getElementById(parentLevel + '_' + level + '_' + id);
    //alert(obj.style.display);
    if (obj.style.display == "none") {
        Hierarchy_Show(parentLevel, level, id);
    }
    else {
        Hierarchy_Hide(parentLevel, level, id);
    }
}

function IsFirefox()
{
    var ua = navigator.userAgent.toLowerCase();
    if (ua.indexOf("firefox") != -1)
    {
        return true;
    }
    return false;
}

function Hierarchy_Show(parentLevel, level, id) {
    var uidCollection = document.getElementsByName(parentLevel + '_' + level + '_' + id);
    //alert(uidCollection.length);
    var i;
    for (i = 0; i < uidCollection.length; i++) {
        uidCollection[i].style.display =  (IsFirefox() ? "table-row" : "block");
        //uidCollection[i].style.display = "block";
    }

}

function Hierarchy_Hide(parentLevel, level, id) {
    var i, j;
    if (id == -1) {
        if (level == -1) {
            for (j = -1; j < 50; j++) {
                for (i = -1; i < 50; i++) {
                    Hierarchy_HideRec(parentLevel + '_' + j + '_' + i);
                }
            }
        }
        else {
            // go over all ids under current level
            for (i = 0; i < 50; i++) {
                Hierarchy_HideRec(parentLevel + '_' + level + '_' + i);
            }
        }
    }

    Hierarchy_HideRec(parentLevel + '_' + level + '_' + id);
}


function Hierarchy_HideRec(uid) {
    var uidCollection = document.getElementsByName(uid);

    var i;
    for (i = 0; i < uidCollection.length; i++) {
        uidCollection[i].style.display = "none";
    }
}

/****************************************************/
/* Track mouse coordinates on the screen            */
/****************************************************/
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;

var MouseX = 0; // Global variables to be used
var MouseY = 0; // Global variables to be used
function getMouseXY(e) 
{
    if (IE) 
    { // grab the x-y pos.s if browser is IE
        MouseX = event.clientX + document.body.scrollLeft;
        MouseY = event.clientY + document.body.scrollTop;
    }
    else
    {  // grab the x-y pos.s if browser is NS
        MouseX = e.pageX;
        MouseY = e.pageY;
    }  
    if (MouseX < 0){MouseX = 0;}
    if (MouseY < 0){MouseY = 0;}  
    
    return true;
}

//this function can be used to radio button list and check box list
function getCheckedListValue(ObjArr,delimiter) {
    var length = 0;
    if (ObjArr != null) {
        length = ObjArr.length;
    }
    var SelectedValues,Temp;
    Temp="";
    SelectedValues="";
    for (var i = 0; i < length; i++) {
        if (ObjArr[i].checked==true)
            {
                SelectedValues=Temp + ObjArr[i].value;
                Temp = delimiter;
            }
        }
        return SelectedValues;
}



//////////////////////////////////////////////////////////// Tooltip JS /////////////////////////////////////////////////
/************************************************************************************************************
(C) www.dhtmlgoodies.com, October 2005
	
This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
Updated:	
March, 11th, 2006 - Fixed positioning of tooltip when displayed near the right edge of the browser.
April, 6th 2006, Using iframe in IE in order to make the tooltip cover select boxes.
		
Terms of use:
You are free to use this script as long as the copyright message is kept intact. However, you may not
redistribute, sell or repost it without our permission.
	
Thank you!
	
www.dhtmlgoodies.com
Alf Magne Kalleland
	
************************************************************************************************************/
var dhtmlgoodies_tooltip = false;
var dhtmlgoodies_tooltipShadow = false;
var dhtmlgoodies_shadowSize = 4;
var dhtmlgoodies_tooltipMaxWidth = 200;
var dhtmlgoodies_tooltipMinWidth = 100;
var dhtmlgoodies_iframe = false;
var tooltip_is_msie = (navigator.userAgent.indexOf('MSIE') >= 0 && navigator.userAgent.indexOf('opera') == -1 && document.all) ? true : false;
function showTooltip(e, tooltipTxt) {

    var bodyWidth = Math.max(document.body.clientWidth, document.documentElement.clientWidth) - 20;

    if (!dhtmlgoodies_tooltip) {
        dhtmlgoodies_tooltip = document.createElement('DIV');
        dhtmlgoodies_tooltip.id = 'dhtmlgoodies_tooltip';
        dhtmlgoodies_tooltipShadow = document.createElement('DIV');
        dhtmlgoodies_tooltipShadow.id = 'dhtmlgoodies_tooltipShadow';

        document.body.appendChild(dhtmlgoodies_tooltip);
        document.body.appendChild(dhtmlgoodies_tooltipShadow);

        if (tooltip_is_msie) {
            dhtmlgoodies_iframe = document.createElement('IFRAME');
            dhtmlgoodies_iframe.frameborder = '5';
            dhtmlgoodies_iframe.style.backgroundColor = '#FFFFFF';
            dhtmlgoodies_iframe.src = '#';
            dhtmlgoodies_iframe.style.zIndex = 100;
            dhtmlgoodies_iframe.style.position = 'absolute';
            document.body.appendChild(dhtmlgoodies_iframe);
        }

    }

    dhtmlgoodies_tooltip.style.display = 'block';
    dhtmlgoodies_tooltipShadow.style.display = 'block';
    if (tooltip_is_msie) dhtmlgoodies_iframe.style.display = 'block';

    var st = Math.max(document.body.scrollTop, document.documentElement.scrollTop);
    var sl = Math.max(document.body.scrollLeft, document.documentElement.scrollLeft);
    if (navigator.userAgent.toLowerCase().indexOf('safari') >= 0) st = 0;
    var leftPos = e.clientX + 10 + sl;

    dhtmlgoodies_tooltip.style.width = null; // Reset style width if it's set 
    dhtmlgoodies_tooltip.innerHTML = tooltipTxt;
    dhtmlgoodies_tooltip.style.left = leftPos + 'px';
    dhtmlgoodies_tooltip.style.top = e.clientY + 10 + st + 'px';


    dhtmlgoodies_tooltipShadow.style.left = leftPos + dhtmlgoodies_shadowSize + 'px';
    dhtmlgoodies_tooltipShadow.style.top = e.clientY + 10 + st + dhtmlgoodies_shadowSize + 'px';

    if (dhtmlgoodies_tooltip.offsetWidth > dhtmlgoodies_tooltipMaxWidth) {	/* Exceeding max width of tooltip ? */
        dhtmlgoodies_tooltip.style.width = dhtmlgoodies_tooltipMaxWidth + 'px';
    }

    var tooltipWidth = dhtmlgoodies_tooltip.offsetWidth;
    if (tooltipWidth < dhtmlgoodies_tooltipMinWidth) tooltipWidth = dhtmlgoodies_tooltipMinWidth;


    dhtmlgoodies_tooltip.style.width = tooltipWidth + 'px';
    dhtmlgoodies_tooltipShadow.style.width = dhtmlgoodies_tooltip.offsetWidth + 'px';
    dhtmlgoodies_tooltipShadow.style.height = dhtmlgoodies_tooltip.offsetHeight + 'px';

//    if ((leftPos + tooltipWidth) > bodyWidth) {
//        dhtmlgoodies_tooltip.style.left = (dhtmlgoodies_tooltipShadow.style.left.replace('px', '') - ((leftPos + tooltipWidth) - bodyWidth)) + 'px';
//        dhtmlgoodies_tooltipShadow.style.left = (dhtmlgoodies_tooltipShadow.style.left.replace('px', '') - ((leftPos + tooltipWidth) - bodyWidth) + dhtmlgoodies_shadowSize) + 'px';
//    }

    if (tooltip_is_msie) {
        dhtmlgoodies_iframe.style.left = dhtmlgoodies_tooltip.style.left;
        dhtmlgoodies_iframe.style.top = dhtmlgoodies_tooltip.style.top;
        dhtmlgoodies_iframe.style.width = dhtmlgoodies_tooltip.offsetWidth + 'px';
        dhtmlgoodies_iframe.style.height = dhtmlgoodies_tooltip.offsetHeight + 'px';

    }

}

function hideTooltip() {
    if (dhtmlgoodies_tooltip.style) {
        dhtmlgoodies_tooltip.style.display = 'none';
        dhtmlgoodies_tooltipShadow.style.display = 'none';
        if (tooltip_is_msie) dhtmlgoodies_iframe.style.display = 'none';
    }
}

function showTooltipByFieldValue(e, tooltipTxt, fldName, fldValue, bIsEqual) {
    if (bIsEqual) {
        if (document.getElementById(fldName).value == fldValue) {
            //alert('kk');
            showTooltip(e, tooltipTxt);

        }
    }
    else {
        if (document.getElementById(fldName).value != fldValue) {
            //alert('kk');
            showTooltip(e, tooltipTxt);

        }
    }
}

function OpenLessonURL(ROOT, MemberID, LessonID) {
    var URL;
    URL = ROOT + "login/StartIW.asp?MemberID=" + MemberID + "&LessonID=" + LessonID;
    window.open(URL, "IWLesson");
}

function OpenHHURL(ROOT, MemberID, LessonRequestID) {
    var URL;
    URL = ROOT + "online/enterIW.asp?MemberID=" + MemberID + "&LessonRequestID=" + LessonRequestID;
    window.open(URL, "IWLesson");
}

function OpenGuestLessonURL(ROOT, LessonID) {
    var URL;
    URL = ROOT + "login/StartIW.asp?FirstName=" + document.EnterGuest.FirstName.value + "&LastName=" + document.EnterGuest.LastName.value + "&LessonID=" + LessonID;
    window.open(URL, "IWLesson");
}

function CheckAdditionalLanguages(FormName, ErrorText) {
    var objForm,objLanguageID,objLevelID;
    objForm = eval("document."+ FormName);
    
    var NumOfFields;
    NumOfFields = objForm.NumOfLanguageFields.value;
    
    for  (i=0;i<NumOfFields;i++)
    {	    
        objLanguageID = eval("document."+ FormName + ".LanguageID" + i);
        objLevelID = eval("document."+ FormName + ".LanguageLevel" + i);	        
        if (objLanguageID.selectedIndex != 0 && objLevelID.selectedIndex == 0)
        {
            AddError(ErrorText);
            break;
        }
    }	    
}
	
/*
* USAGE in HTML: 
* onmouseover="showTooltip(event,'This is a tooltip content.');return false"
*/
//////////////////////////////////////////////////////////// Tooltip JS //////////////////////////////////////////////////
