/* :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
/* Script written by Yamen Elasadi - Professional Validator */
/* © Copy Right Protected Data Mortgage, EquiLoans Home Advisors® */
/* All Rights Reserved, www.DataMortgage.com */


//********************************POP-UP Functions******************************
<!-- Begin
function NewWindow(mypage, myname, w, h, scroll, status, t) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',status='+status+',toolbar='+t+''
win = window.open(mypage, myname, winprops)
}
function FNNewWindow(mypage, myname, w, h, scroll, status, t, Action, Method, Frus) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',status='+status+',toolbar='+t+',resizable'
win = window.open(mypage+Action+Method+Frus, myname, winprops)
}
// End -->
<!-- Begin
function showCertDetails()
	{
	thewindow = window.open('https://www.datamortgage.com/support/ssl_information.html', 'anew', config='height=510,width=792,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=yes');
	}
// End -->
<!-- Begin
function showGoDaddyCertDetails()
	{
	thewindow = window.open('https://seal.godaddy.com/verifySeal?sealID=149871645401d709a512710004c4fa8b17e8d098676035925368360', 'anew', config='height=367,width=628,toolbar=no,menubar=no,scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
	}
// End -->
<!-- Begin
function showReferralRules()
	{
	thewindow = window.open('https://www.datamortgage.com/refer/referral_rules.html', 'anew', config='height=500,width=750,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,directories=no,status=no');
	}
// End -->

//************************ HTML POP-UP WINDOW ************************
<!-- Begin
var bookPopoverTimer = null;

function sitb_showLayer(obj) {
  if(document.layer) {
	return; // netscape 4
  }

  if(bookPopoverTimer) {
    clearTimeout(bookPopoverTimer);
    bookPopoverTimer = null;
  }

  var sitb_lyr = sitb_getLayer(obj);
  if(!sitb_lyr) {
    return;
  }
  
  var sitb_img = sitb_getLayer('prodimage');
  if(!sitb_img) {
    return;
  }

  var sitb_x, sitb_y, sitb_temp;
  if(sitb_img.x) {
    sitb_x = sitb_img.x;
  } else {
    sitb_temp = sitb_img;
    sitb_x = sitb_img.offsetLeft;
    while(sitb_temp.offsetParent) {
      sitb_temp = sitb_temp.offsetParent;
      sitb_x += sitb_temp.offsetLeft;
    }
  }
  if(sitb_img.y) {
    sitb_y = sitb_img.y;
  } else {
    sitb_temp = sitb_img;
    sitb_y = sitb_img.offsetTop;
    while(sitb_temp.offsetParent) {
      sitb_temp = sitb_temp.offsetParent;
      sitb_y += sitb_temp.offsetTop;
    }
  }

    sitb_lyr.style.visibility="visible";
    sitb_lyr.style.display="block";
    sitb_lyr.style.left = sitb_x + (sitb_img.width / 2);
    sitb_lyr.style.top = sitb_y + (sitb_img.height / 2);
}

function sitb_getLayer(obj) {
  if(document.layers) {
    return document.layers[obj];
  } else if(document.all && !document.getElementById) {
   return document.all[obj];
  } else if(document.getElementById) {
   return document.getElementById(obj);
  } else {
   return null;
  }
}

function sitb_hideLayer(obj) {

  var sitb_lyr = sitb_getLayer(obj);
 
  if(!sitb_lyr) {
    return;
  }

  if(document.layers) {
    sitb_lyr.visibility="hidden";
  } else {
    sitb_lyr.style.display="none";
    sitb_lyr.style.visibility="hidden";
  }

}

function sitb_doHide (obj) {
  if(document.layer) {
    return;
  }
  bookPopoverTimer = setTimeout('sitb_hideLayer("' + obj +'")', 50);  
}

if(document.layers) {
 sitb_hideLayer('bookpopover');
 
} else {

}
// End -->


//********************************POP-UP Functions******************************
<!-- Begin

/* Function   : popWindowToScale	
Description: Pops a new window to the specified width and height
Arguments: page -> html,aspx,php page to open
       
winName -> identifier of the new window instance
width -> width of window
height -> height of window */

		function popWindow(page, winName, width, height) 
		{
			var browser_name = navigator.appName;
			
			if (browser_name.indexOf("WebTV") != -1) return null;
			
			// Find the center position to launch the window to
			if (parseInt(navigator.appVersion) >= 4 )
			{
				xposition = (screen.width - width) / 2;
				yposition = (screen.height - height) / 2;
			}

			// Assign the window arguments
			args = "width=" + width + ",";
			args += "height=" + height + ",";
			args += "location=0" + ",";
			args += "menubar=0" + ",";
			args += "resizable=0" + ",";
			args += "scrollbars=0" + ",";
			args += "status=1" + ",";
			args += "titlebar=1" + ",";
			args += "toolbar=0" + ",";
			args += "hotkeys=0" + ",";
			args += "screenx=" + xposition + ",";
			args += "screeny=" + yposition + ",";
			args += "left=" + xposition + ",";
			args += "top=" + yposition;
			
			var new_window = window.open(page, winName, args);
			new_window.focus();
		}

/* -------------------------------------------------- */
/* Function   : popWindowNoStatusBar	
Description: Pops a new window to the specified width and height and with no status bar
Arguments: page -> html,aspx,php page to open

winName -> identifier of the new window instance
width -> width of window
height -> height of window
----------------------------------------------------- */
		function popWindowNoStatusBar(page, winName, width, height) 
		{
			var browser_name = navigator.appName;
			
			if (browser_name.indexOf("WebTV") != -1) return null;
			
			// Find the center position to launch the window to
			if (parseInt(navigator.appVersion) >= 4 )
			{
				xposition = (screen.width - width) / 2;
				yposition = (screen.height - height) / 2;
			}

			// Assign the window arguments
			args = "width=" + width + ",";
			args += "height=" + height + ",";
			args += "location=0" + ",";
			args += "menubar=0" + ",";
			args += "resizable=0" + ",";
			args += "scrollbars=0" + ",";
			args += "status=0" + ",";
			args += "titlebar=0" + ",";
			args += "toolbar=0" + ",";
			args += "hotkeys=0" + ",";
			args += "screenx=" + xposition + ",";
			args += "screeny=" + yposition + ",";
			args += "left=" + xposition + ",";
			args += "top=" + yposition;
			
			var new_window = window.open(page, winName, args);
			new_window.focus();
		}

/* -------------------------------------------------- */
/* Function   : popWindowToScale	
Description: Pops a new window to the specified scale percentage
Arguments: page -> html,aspx,php page to open

winName -> identifier of the new window instance
scalePerc -> the scale percentange the 
window should open up to (ex. if 75%, enter 75) 
----------------------------------------------------- */
		function popWindowToScale(page, winName, scalePerc) 
		{
			var browser_name = navigator.appName;
			
			// Change scalePerc value to it's decimal equivalent
			var perc = scalePerc * .01;
			
			// Apply the scale ratio to both the width and height
			var width = Math.floor(screen.width * perc);
			var height = Math.floor(screen.height * perc);
			
			if (browser_name.indexOf("WebTV") != -1) return null;
			
			// Find the center position to launch the window to
			if (parseInt(navigator.appVersion) >= 4 )
			{
				xposition = (screen.width - width) / 2;
				yposition = (screen.height - height) / 2;
			}

			// Assign the window arguments
			args = "width=" + width + ",";
			args += "height=" + height + ",";
			args += "location=1" + ","
			args += "menubar=1" + ","
			args += "resizable=1" + ","
			args += "scrollbars=1" + ","
			args += "status=1" + ","
			args += "titlebar=1" + ","
			args += "toolbar=1" + ","
			args += "hotkeys=0" + ","
			args += "screenx=" + xposition + ",";
			args += "screeny=" + yposition + ",";
			args += "left=" + xposition + ",";
			args += "top=" + yposition;
			
			var new_window = window.open(page, winName, args);
			new_window.focus();
		}

/* -------------------------------------------------- */
/* Function   : ResetValidation	
Description: The only thing this function does is return true.  Used to reset
custom validation controls whose error state is normally set viacode.
----------------------------------------------------- */
		function ResetValidation(strHTMLID) {
		  document.getElementById(strHTMLID).style.isvalid = "True";
		  return true;
		}


/* -------------------------------------------------- */
/* Function   : DisplayElement	
Description: Dynamically hides/shows a HTML element based on the value
			of a webform control, additionally it can enabled/disable an
			associated webform validation control.
	Arguments  : strHTMLID	- ID of the HTML element you wish to hide/show.
				flgDisplay	- determines of the visibilty attribute is to be set to 'hidden' or 'visible'
				flgIsDynamic - when true this causes the web page to be dynamically
								resized when the element is hidden/displayed. 
----------------------------------------------------- */
		function DisplayElement(strHTMLID, flgDisplay, flgIsDynamic) {
			
		  if(flgDisplay == true)
		    {
		      document.getElementById(strHTMLID).style.visibility = 'visible';
		      if(flgIsDynamic == true)
		        {document.getElementById(strHTMLID).style.display = '';}
		    }
		  else
		    {
		      document.getElementById(strHTMLID).style.visibility = 'hidden';
		      if(flgIsDynamic == true)
		        {document.getElementById(strHTMLID).style.display = 'none';}
		    }		    		  
		  return true;
		}
    
/* -------------------------------------------------- */
/* Function   : DisplayElement	
Description: Originally intended to enable disable page validation controls
			when the input fields are hidden/displayed.
Arguments  : strHTMLID	   - ID of the HTML element you wish to hide/show.
			flgEnabled   - value to set the 'enabled' attribute to.
----------------------------------------------------- */
    function EnableElement(strHTMLID, flgEnabled) {
      if(flgEnabled == true)
		    {
          document.getElementById(strHTMLID).setAttribute('enabled', true);
		    }
		  else
		    {
  	      document.getElementById(strHTMLID).setAttribute('enabled', false);
		    }		    		  
		  return true;
		}

/* ------------------------------------------------------------------------------------ */

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
