$(document).ready(function(){
			// Quick address bar hide on devices like the iPhone
 // Hides mobile browser's address bar when page is done loading.
  window.addEventListener('load', function(e) {
    setTimeout(function() { window.scrollTo(0, 1); }, 1);
  }, false);				   
});

(function(){
  // if firefox 3.5+, hide content till load (or 3 seconds) to prevent FOUT
  var d = document, e = d.documentElement, s = d.createElement('style');
  if (e.style.MozTransform === ''){ // gecko 1.9.1 inference
    s.textContent = 'body{visibility:hidden}';
    e.firstChild.appendChild(s);
    function f(){ s.parentNode && s.parentNode.removeChild(s); }
    addEventListener('load',f,false);
    setTimeout(f,3000); 
  }
})();



window.onload = function() {
	
  if (!document.getElementsByTagName) return false;
  var lnks = document.getElementsByTagName("a");
  for (var i=0; i<lnks.length; i++) {
    if (lnks[i].className == "mailingPopup2") {
      lnks[i].onclick = function() {
        mailingPopUp2(this.getAttribute("href"));
        return false;
      }
    }
  }
}
function mailingPopUp2(winURL) {
  window.open(winURL,"mailingPopup2","width=560,height=560");
}







//function addLoadEvent(func) {
//  var oldonload = window.onload;
//  if (typeof window.onload != 'function') {
//    window.onload = func;
//  } else {
//    window.onload = function() {
//      oldonload();
//      func();
//    }
//  }
//}
//
//addLoadEvent(prepareLinks);
//
//function prepareLinks() {
//  if (!document.getElementsByTagName) return false;
//  var links = document.getElementsByTagName("a");
//  for (var i=0; i<links.length; i++) {
//    if (links[i].getAttribute("class") == "mailingPopup") {
//      links[i].onclick = function() {
//        mailingPopUp(this.getAttribute("href"));
//        return false;
//      }
//	}  
//	  else if (links[i].getAttribute("class") == "audioPopup") {
//      links[i].onclick = function() {
//        audioPopUp(this.getAttribute("href"));
//        return false;
//      }
//	}
//  }
//}
//
//function mailingPopUp(winURL) {
//  window.open(winURL,"mailingPopup","width=540,height=560");
//}
//function audioPopUp(winURL) {
//  window.open(winURL,"audioPopup","width=820,height=480");
//}













var Win=0;
function popUps(URLStr, width, height)
				{
  				var top=50;
  				var left=50;
  				
  				if(Win){
    			if(!Win.closed) Win.close();
  				}
  				Win = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
		}
		
		
		
		
		
		
		
// OPEN IN NEW WINDOW
////////////////////////////////////////////////////

function addEvent( obj, type, fn )
{
	if (obj.addEventListener)
		obj.addEventListener( type, fn, false );
	else if (obj.attachEvent)
	{
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
	}
}

/* Create the new window */

function openInNewWindow(e) {
	var event;
	if (!e) event = window.event;
	else event = e;
	// Abort if a modifier key is pressed
	if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) {
		return true;
	}
	else {
		// Change "_blank" to something like "newWindow" to load all links in the same new window
	    var newWindow = window.open(this.getAttribute('href'), 'newWindow');
		if (newWindow) {
			if (newWindow.focus) {
				newWindow.focus();
			}
			return false;
		}
		return true;
	}
}

/* Add the openInNewWindow function to the onclick event of links with a class name of "new-window" */

function getNewWindowLinks() {
	// Check that the browser is DOM compliant
	if (document.getElementById && document.createElement && document.appendChild) {
		
		// Find all links
		var links = document.getElementsByTagName('a');
		
		var link;
		for (var i = 0; i < links.length; i++) {
			link = links[i];
			// Find all links with a class name of "bounce"
			if (/bounce/.test(link.className)) {
				
				link.onclick = openInNewWindow;
			}
		}
		objWarningText = null;
	}
}

addEvent(window, 'load', getNewWindowLinks);

		
// CLEAR TEXT INPUT VALUE

////////////////////////////////////////////////////

//Script by http://www.java-Scripts.net and http://wsabstract.com

function doClear(theText) {
     if (theText.value == theText.defaultValue) {
         theText.value = ""
     }
 }
