	function viewRegion(i, j) {
		
		// alert(gmarkers[i]);
		// alert(gCBDmarkers[i]);
		
		if (j == 0)						
	  	gmarkers[i].openInfoWindowHtml(htmls[i]);
	  else
	  	gCBDmarkers[i].openInfoWindowHtml(CBDhtmls[i]);
	  	
	   // alert('once not using iframe: go to ' + i + ' : ' + j);
	}	
	
function popUp (url, width, height) {			
	//center the pop-up	
	if (parseInt(navigator.appVersion) >= 4 ) {
		xposition = (screen.width - width) / 2;
		yposition = (screen.height - height) / 2;}

	args = "width=" + width + ","
	+ "height=" + height + ","
	+ "location=0," 
	+ "menubar=0,"
	+ "resizable=1,"
	+ "scrollbars=1,"
	+ "status=no," 
	+ "titlebar=1,"
	+ "toolbar=0,"
	+ "hotkeys=0,"
	+ "screenx=" + xposition + ","  //NN Only
	+ "screeny=" + yposition + ","  //NN Only
	+ "left=" + xposition + ","     //IE Only
	+ "top=" + yposition;           //IE Only
		
	window.open(url,'myfile',args );
}	
	
function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1) 
      return element;

    elements.push(element);
  }

  return elements;
}

function toggle(obj) {
	var el = document.getElementById(obj);
	if ( el.style.display != 'none') {
		el.style.display = 'none';
	} else {
		el.style.display = '';
	}
}	

function map_toggle(map1, map2) {
	
	//$(map1).style.fontWeight = 'normal'; 
	//$(map1).style.textDecoration = 'underline';
	
	//$(map2).style.fontWeight = 'bold';
	//$(map2).style.textDecoration = 'none';
	
	$('nav_' + map1).style.display = 'block';
	$('nav_' + map2).style.display = 'none';

}

function getWindowHeight() {

	if (typeof(window.innerHeight)=='number')
		return window.innerHeight;
	
	if (document.documentElement && document.documentElement.clientHeight)
		return document.documentElement.clientHeight;
		
	if (document.body && document.body.clientHeight)
		return document.body.clientHeight;
		
	return 0;

}


function getWindowWidth() {
	
	if (typeof(window.innerWidth)=='number')
		return window.innerWidth;
	
	if (document.documentElement && document.documentElement.clientWidth)
		return document.documentElement.clientWidth;
		
	if (document.body && document.body.clientWidth)
		return document.body.clientWidth;
		
	return 0;	
}

function loadFullImage(logged_in, image, w, h, image_name, thumnails, textlist, description, prev, next, sess_id, seq, img_id) {
	
	var windowHeight = getWindowHeight();
	var windowWidth = getWindowWidth();	
	var vtop = 0;
	var vleft = 0;
		
	windowWidth_r = Math.round(windowWidth * 0.8);
	windowHeight_r = Math.round(windowHeight * 0.8);

	if (windowWidth_r >= windowWidth || windowHeight_r >= windowHeight) {
		windowWidth_r = Math.round(windowWidth * 0.6);
		windowHeight_r = Math.round(windowHeight * 0.6);
	}

		
	
	if (w >= windowWidth_r) {
		h = Math.round((windowWidth_r / w) * h);
		w = windowWidth_r;					
	} else {
		//windowWidth_r = w;
		//windowHeight_r = h;
	}
	
	if (h >= windowHeight_r) {
		w = Math.round((windowHeight_r / h) * w);		
		h = windowHeight_r;
	}	else {
		//windowWidth_r = w;
		//windowHeight_r = h;
	}
		

	vtop = Math.round((windowHeight - h) / 3);
	vleft = Math.round((windowWidth - w) / 2) - 10;
						
	$('light').innerHTML = '<img src="/images/loader.gif" />'
	
	var argh = '';
	// add the main image
	argh += '<a href="#" onclick="document.getElementById(\'light\').style.display=\'none\'; document.getElementById(\'fade\').style.display=\'none\'"><img src="' + image + '" width="' + w + '" height="' + h + '" style="margin-top: 10px;" title="Click to Close"/></a>';
	
	// add the top navigation
	argh += '<div id="popup_header" style="position: absolute; top: 0px; left: 0px;">';
	argh += '<strong>'+image_name+'</strong>';
	argh += ' / <a href="' + thumnails + '">thumbnails</a> / ';
	// argh += '<a href="' + textlist + '">text list</a> / ';
	argh += '<a href="' + description + '">description</a>';
	
	if (prev != "")
		argh += ' / <a href="' + prev + '">previous</a>';
	
	if (next != "")
		argh += ' / <a href="' + next + '">next</a>';
			
	argh += '</div>';
		
	// add bottom navigation	
	argh += '<div id="popup_footer" style="position: absolute; bottom: 0px; right: 0px; color: #000000;">';
	if (logged_in == 1) {
		argh += '<a href="'+image+'">Save</a> / ';
		argh += '<a href="#" onClick="window.print(); return false;">Print</a> / ';
		argh += '<a href="mailto: YOURFRIEND@DOMAIN.COM?body=http://www.filmmelbournelocations.com' + image + '">Email</a> / ';
		argh += '<a href="#" onClick="addToPort(' + sess_id + ', \'' + seq + '\', \'' + img_id + '\'); return false;">Add to Album</a> / ';
	}
	argh += '<a href = "javascript:void(0)" onclick="document.getElementById(\'light\').style.display=\'none\'; document.getElementById(\'fade\').style.display=\'none\'">Close</a> ';
	argh += '</div>';	

	$('light').style.width = w + 'px';
	$('light').style.height = (h + 20) + 'px';
	$('light').innerHTML = argh;
	$('light').style.top = vtop + 'px';
	$('light').style.left = vleft + 'px';
}


function qs() {
	
	var qsParm = new Array();	
	
	var query = window.location.search.substring(1);
	var parms = query.split('&');
	for (var i=0; i<parms.length; i++) {
		var pos = parms[i].indexOf('=');
		if (pos > 0) {
			var key = parms[i].substring(0,pos);
			var val = parms[i].substring(pos+1);
			qsParm[key] = val;
		}
	}
	
	return qsParm;	
}

function submitRegister() {
	
	if ($('fname').value == ' ' || $('fname').value.length == 0) {
		alert('Please enter your first name');
		return false;
	}
	
	if ($('sname').value == ' ' || $('sname').value.length == 0) {
		alert('Please enter your surname');
		return false;
	}	
	
	if ($('company').value == ' ' || $('company').value.length == 0) {
		alert('Please enter your Company');
		return false;
	}	
	
	if ($('email').value == ' ' || $('email').value.length == 0 || $('email').indexOf('@') == -1) {
		alert('Please enter a complete email address');
		return false;
	}	
	
	if ($('phone').value == ' ' || $('phone').value.length == 0) {
		alert('Please enter your Telephone Number');
		return false;
	}		
	
	if ($('location').value == ' ') {
		alert('Please select your Location');
		return false;
	}		
	
	return true;
	
}

function load_video() {
	var v1 = window.location.search.substring(1);
	document.getElementById('load_content').src = "http://203.88.117.89/cms/popup.viewvideo.php?" + v1;
}

function load_whatsnew() {
	var v1 = window.location.search.substring(1);
	document.getElementById('load_content').src = "http://203.88.117.89/cms/popup.whatsnew.php?" + v1;
	// 
}

function s_access(key) {
	document.getElementById('theKW').value = key;
	document.getElementById('Contains').submit();
}
