function switchimage(oldimg, newimg) {
	var img = document.getElementById(oldimg);
	img.setAttribute('src', 'assets/images/' + newimg);
}
function resizeimage(id){
	var img = document.getElementById(id);
	document.getElementById('711maptrigger').onclick = function(){shrinkimage('711map');}
	if (img.src == "http://speakout7eleven.ca/assets/images/7-11_map_1.jpg" || img.src == "http://www.speakout7eleven.ca/assets/images/7-11_map_1.jpg"){
		img.src = 'assets/images/7-11_map_Lg.jpg';
		img.setAttribute('height',600);
	}else{
	img.setAttribute('height',900);
	}
}
function shrinkimage(id){
	var img = document.getElementById(id);
	document.getElementById('711maptrigger').onclick = function(){resizeimage('711map');};
	img.setAttribute('height',459);
}

function closePromo()
{
	document.getElementById('promopop').parentNode.removeChild(document.getElementById('promopop'));
}

function openPromo(xdate)
{
	var promo = "/assets/images/aug09promo/monthly_promo_pop.jpg";
	var current = new Date();


    div						= document.createElement('div');
    div.id					= 'promopop';
    if (current.getMonth() != 4){
		dleft					= (window.screen.width  - 400)/2;
	}
	else{
		dleft					= (window.screen.width  - 770)/2;
	}

    dtop					= (parseInt(window.screen.height) - 600)/4;
    div.style.position		= 'absolute';
    div.style.top			= dtop + 'px';
    div.style.left			= dleft + 'px';
    div.style.background	= "url("+promo+") no-repeat 0 0";
    div.innerHTML			= '<a style="float:right;font-weight:bold;margin-right:5px;color:#ffffff;font:bold 12px arial;" href="#" onclick="closePromo(); return false;">CLOSE</a>';
    if (current.getMonth() != 4){
		div.style.width			= '400px';
	}
	else{
		div.style.width			= '770px';
	}

    div.style.height		= '600px';
    div.style.zIndex		= '1000';
    document.body.appendChild(div);
}

function fixLoad() {
	if(document.getElementsByTagName) {
		var objs = document.getElementsByTagName("object");
		for(i = 0; i < objs.length; i++) {
			objs[i].outerHTML = objs[i].outerHTML;
		}
	}
}

window.onload = function() { fixLoad(); }

