nn4 = (document.layers) ? true : false;
ie4 = (document.all) ? true : false;
dom = (document.createTextNode)? true : false;

function popupWindow(fileUrl, winW, winH, winN, scrollB) {
	var winWidth = (winW)? winW : 740;
	var winHeight = (winH)? winH : 520;
	var winName = (winN)? winN : 'popupWin'
	var scrollBars = (scrollB)? scrollB : 'auto'
	if (nn4 || ie4 || dom) {
		if (screen.width < winWidth + 50) { winWidth = screen.width - 50; scrollbars = 'yes' }
		if (screen.height < winHeight + 100) { winHeight = screen.height - 100; scrollbars = 'yes' }
		posX = Math.round((screen.width - winWidth) / 2);
		posY = Math.round((screen.height - winHeight) / 2);
		posCode = (nn4)? "screenX="+posX+",screenY="+posY : "left="+posX+",top="+posY;
	} else {
		posCode = "";
	}
	var popupWin = window.open(fileUrl, winName,"menubar=no,toolbar=no,scrollbars=" + scrollBars + ",status=yes,resizable=yes,width=" + winWidth + ",height=" + winHeight + "," + posCode);
	if (popupWin) popupWin.focus();
}

function changeView(id){
	for(i=0; i <= count; i++){
		document.getElementById('region'+i).style.display = 'none';
		document.getElementById('r'+i).className = '';
	}
	if(id == 0){
		document.getElementById('div_flashmap').style.height = '450px';
		document.getElementById('div_flashmap').style.display = 'block';
		document.getElementById('bullets').style.display = 'block';
	}else{
		document.getElementById('div_flashmap').style.display = 'none';
		document.getElementById('bullets').style.display = 'none';
	}
	document.getElementById('r'+id).className = 'active';
	document.getElementById('region'+id).style.display = 'block';
}


function selectDoW(dow){
	if(currentDoW != ''){
		document.getElementById(currentDoW).style.display = 'none';
		document.getElementById('a'+currentDoW).className = '';
	}
	document.getElementById(dow).style.display = 'block';
	document.getElementById('a'+dow).className = 'selected';
	currentDoW = dow;
//	alert(currentDoW);
}

function showElement(elemID){
	var elem = document.getElementById(elemID);
	var img = document.getElementById('i_'+elemID);
	if(elem.style.display == 'none'){
		elem.style.display = 'block';
		img.src = '/i/i-minus.gif';
	}else{
		elem.style.display = 'none';
		img.src = '/i/i-plus.gif';
	}
}

function openPopup(aObject, url, width, height){
	var defWidth = 500;
	var defHeight = 500;
	if( !width ){width = defWidth;}
	if( !height ){height = defHeight;}
	if( !url ){url = aObject.href;}
	window.open(url, "Link", "width="+width+",height="+height+",scrollbars=yes,resizable=yes");
	//alert(url);
	return false;
}

function showGroup(elemID){
	var elem = document.getElementById('d'+elemID);
	if((elem.style.display == 'none') || (elem.style.display == '')){
		elem.style.display = 'block';
	}else{
		elem.style.display = 'none';
	}
}

function showPoints(points, region_id){
	var elem = document.getElementById('receiver');
	var region_elem = document.getElementById('RegionStores');
	region_elem.innerHTML = '';
	var unique_id = 1;
	elem.innerHTML = '';
	sender = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"'+
					'codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="20" height="20">'+
						'<param name="allowScriptAccess" value="sameDomain" />'+
						'<param name="movie" value="/flash-map/sender.swf" />'+
						'<param name="flashvars" value="lc_num='+unique_id+'&idMap='+points+'" />'+
				'<embed src="/flash-map/sender.swf" '+
					'flashvars="lc_num='+unique_id+'&idMap='+points+'" width="20" height="100"'+
					'allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />'+
				'</object>';
	elem.innerHTML = sender;
	
	region_elem.innerHTML = document.getElementById('regionShops_'+region_id).innerHTML;
//	alert(sender)
}