// global javascripts for misaustralia.com


// function blank() & function leave()
// Controls the value and textcolor for the search archive inputfield
function blank(){
	 document.searchform.search.value = "";
	 document.searchform.search.style.color = "#222";
}
function leave(){
	if (document.searchform.search.value == ""){
		document.searchform.search.style.color = "#999";
		document.searchform.search.value = "Search MIS.archive";
	}
} 
//########################################

// function disableFlashAds() & function showFlashAds()
// Controls the visibility of the ads,  functions will called within the lightbox.js, line 363 & line 666
function hideFlashAds(){
	document.getElementById('medRectangle').style.visibility = 'hidden';
	document.getElementById('bannerLeaderboard').style.visibility = 'hidden';
}

function showFlashAds(){
	document.getElementById('medRectangle').style.visibility = 'visible';
	document.getElementById('bannerLeaderboard').style.visibility = 'visible';
}
//########################################

// function surfto_networksites()
// Controls the Network sites navigation select box
function surfto_networksites(site) {
	if (site == 0) {location.href= 'http://www.afr.com/';}
	if (site == 1) {location.href= 'http://www.marketwrap.com.au/';}
	if (site == 2) {location.href= 'http://www.afrboss.com.au/';}
	if (site == 3) {location.href= 'http://www.afrmagazine.com.au/';}
	if (site == 4) {location.href= 'http://www.afrsmartinvestor.com.au/';}
	if (site == 5) {location.href= 'http://www.assetmag.com.au/';}
	if (site == 6) {location.href= 'http://www.brw.com.au/';}
	if (site == 7) {location.href= 'http://www.cfoweb.com.au/';}
	if (site == 8) {location.href= 'http://www.misweb.com/';}
	if (site == 9) {location.href= 'http://www.fairfaxbr.com.au/about.asp';}
}
//########################################

// function surfto_networksites()
// Controls the Network sites navigation select box
function surfto_pastmagazines(site) {
	if (site >= 0 ) {
		if (site == 0 ) {location.href= '/magazine/default.aspx';}
		else {location.href= '/magazine/magazine_issue' + site + '.aspx';}
	}
}
//########################################

var emStepWidth 	= 0.125;	// increase/decrease font every step by EmStepWidth
var emBasis 		= 1.1;		// font size at startup
var emStep 		= 0;		// counter for current step (leave as 0)
var emMaxSteps 	= 2;		// maximum steps alowed

function fontSizer(Inc, Reset) {
if (Reset)
	emStep = -1;
	if (Math.abs(emStep + Inc) <= emMaxSteps) {
	emStep += Inc;
	emFontSize = emStep * emStepWidth + emBasis;
	emBody = document.getElementById('main_content_wrap');
	emBody.style.fontSize = emFontSize + "em";
	}
} 


//########################################
//Email A Friend functions

function getQueryVariable(variable) {
  var query = window.location.search.substring(1);
  var vars = query.split("&");
  for (var i=0;i<vars.length;i++) {
    var pair = vars[i].split("=");
    if (pair[0] == variable) {
		return unescape(pair[1]);
    }
  } 
}

function formatEmailAFriend1() {
	var docTitle;
	var qsTitle = getQueryVariable("title");
	if(qsTitle!=undefined)
		docTitle = qsTitle;
	else 
		docTitle = escape(document.title);
	docURL = escape(document.URL);
	window.open('/EmailPage.aspx?link=' + docURL  +  '&amp;title=' + docTitle,'Email','location=0,menubar=0,scrollbars=0,resizable=1,width=720,height=315');
	//alert('/EmailPage.aspx?link=' + docURL  +  '&amp;title=' + docTitle,'Email','location=0,menubar=0,scrollbars=0,resizable=0,width=720,height=315');
}


function formatEmailAFriend2() {

	window.open('/EmailPage.aspx?link=' + docURL  +  '&title=' + docTitle,'Email','location=0,menubar=0,scrollbars=0,resizable=1,width=720,height=315');
	//window.open('/EmailPage.aspx?link=' + docURL  +  '&title=','Email','location=0,menubar=0,scrollbars=0,resizable=0,width=720,height=315');

}


//#######################################
//Expand and Collapse Newsletter box

function switchMenu(obj) {
			var el = document.getElementById(obj);
			if ( el.style.display != "none" ) {
				el.style.display = 'none';
			}
			else {
				el.style.display = '';
			}
}


