// JavaScript Document
var frameURLs = [];
var currentURL = '';

$ = function(id) { 	return document.getElementById(id); }
viewFrame = function (url)
{
	//
	blayer('popupButtonLink',url[1][0] == '' ? false : true);
	blayer('mlayer',true);
	blayer('popupLayerZ',true);
	$('popupFrame').src = currentURL = url[0][0];
	
	$('popupFrame').width = url[0][1];
	$('popupButton').style.left = url[0][1] - 111 + 'px';
	
	frameURLs = url;
}
closeFrame = function()
{
	blayer('mlayer',false);
	blayer('popupLayerZ',false);
	frameURLs = [];
	$('popupFrame').src = 'about:blank';
}
blayer = function(id, show)//false - hide, true - show
{
	if(show){
		$(id).style.display = 'block';
	} else {
		$(id).style.display = 'none';
	}
}
nextFrameURL = function(obj)
{
	if (frameURLs == []){
		return;
	}
	if (currentURL == frameURLs[0][0]){
		$('popupFrame').src = currentURL = frameURLs[1][0];
		$('popupButton').src = 'images/popup_btn_info.gif';
		$('popupFrame').width = frameURLs[1][1];
		//$('popupButton').style.left = frameURLs[1][1] - 111 + 'px';
	} else {
		$('popupFrame').src = currentURL = frameURLs[0][0];
		$('popupButton').src = 'images/popup_btn_photo.gif';
		$('popupFrame').width = frameURLs[0][1];
		//$('popupButton').style.left = frameURLs[0][1] - 111 + 'px';
	}
	obj.blur();
}