var xmlns = 'http://www.w3.org/1999/xhtml';

/* Internet Explorer... */
if(!document.createElementNS)
{
	document.createElementNS = function(ns, el)
	{
		return document.createElement(el);
	};
}
/*
if(!window.DOMInitialised)
{
	Event.onDOMReady(init);
}
else
{
	window.setTimeout(init, 1);
}*/
function imageOn(){
	image = document.getElementById("imageBox");
	image.style.visibility ='visible';
}
function imageOff(){
	image = document.getElementById("imageBox");
	image.style.visibility='hidden';
}
function init()
{
	$A(document.getElementsByClassName('popup')).each(function(obj) { Event.observe(obj, 'click', popup, false); });
	if($('page_content'))
	{
		var links = $('page_content').getElementsByTagName('a');
		if(document.getElementsByTagName('base').length > 0)
		{
			var linkRe = new RegExp("^" + document.getElementsByTagName('base')[0].href + "(?!\/?external)");
		}
		else
		{
			var linkRe = new RegExp("^(https?\:\/\/|external)");
		}

		for(var i = links.length - 1; i >= 0; i--)
		{
			if(links[i].href && !linkRe.test(links[i].href))
			{
				Event.observe(links[i], 'click', popup, false);
			}
		}
	}
	
	if($('signup_email'))
	{
		$('signup_email').observe('blur', checkSignupBgImage, false);
		
		checkSignupBgImage('signup_email');
	}
};

/**
 * Pop up a link in a new window.
 * @param evt Event
 */
function popup(evt)
{
	var el = Event.element(evt);
	
	do
	{
		if(/a/i.test(el.tagName))
		{
			window.open(el.href, null);
			Event.stop(evt);
			break;
		}
	}
	while(el = el.up());
};

/**
 * Ensure that there is no background image when there is text in the field.
 * @param evt Event|String
 */
function checkSignupBgImage(evt)
{
	if(typeof evt == 'string')
	{
		var tgt = $('signup_email');
	}
	else
	{
		var tgt = Event.element(evt);
	}
	
	if(tgt.value == '')
	{
		tgt.style.backgroundImage = '';
	}
	else
	{
		tgt.style.backgroundImage = 'none';
	}
};

function mypopup(url)
 {
   mywindow = window.open (url,  "mywindow","resizable=1,scrollbars=1,  width=950,height=700");
}

function printContent(id){
str=document.getElementById(id).innerHTML
newwin=window.open('','printwin','left=100,top=100,width=600,height=800')
newwin.document.write('<HTML>\n<HEAD>\n')
newwin.document.write('<TITLE>Print Page</TITLE>\n')
newwin.document.write('<script>\n')
newwin.document.write('function chkstate(){\n')
newwin.document.write('if(document.readyState=="complete"){\n')
newwin.document.write('window.close()\n')
newwin.document.write('}\n')
newwin.document.write('else{\n')
newwin.document.write('setTimeout("chkstate()",2000)\n')
newwin.document.write('}\n')
newwin.document.write('}\n')
newwin.document.write('function print_win(){\n')
newwin.document.write('window.print();\n')
newwin.document.write('chkstate();\n')
newwin.document.write('}\n')
newwin.document.write('<\/script>\n')
newwin.document.write('<link rel="stylesheet" type="text/css" href="scripts/master.css" />\n')
newwin.document.write('</HEAD>\n')
newwin.document.write('<BODY onload="print_win()">\n')
newwin.document.write(str)
newwin.document.write('</BODY>\n')
newwin.document.write('</HTML>\n')
newwin.document.close()
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function hide(id){
        var close = document.getElementById(id);
        close.style.visibility='hidden';
        close.style.display = "none";


};

function disabler(){
	button = document.getElementById("submitCover");
	button.style.visibility='visible';
	button.style.display = "block";	
	return true;
}

function hoverImage(id){
    var show = document.getElementById(id);
    show.style.visibility='visible';
        show.style.display = "block";
}

