$(function() {
	$("#dialogX").dialog({
		resizable: false,
		height: 280,
		width: 400,
		modal: true,
		autoOpen: false
	});
});

function opendlg(){
	$("#dialogX").dialog('open');
}

function closedlg(){
	$("#dialogX").dialog('close');
}

/* function to control the manual load banner script */
function imageBanner(){
	$('#b_gallery a').click(function(evt) {
		//don't follow link
		evt.preventDefault();
		//get path to new image
		var imgPath = $(this).attr('href');
		//get reference to old image
		var oldImage = $('#b_photo img');
		if (imgPath == oldImage.attr('src')) {
			//if they are then you're done
			return;
		} else {
			//create HTML for new image
			var newImage = $('<img src="' + imgPath +'">');
			//make new image invisible
			newImage.hide();
			//add to the #b_photo div
			$('#b_photo').prepend(newImage);
			//fade out old image and remove from DOM
			oldImage.fadeOut(1000,function(){
				$(this).remove();
			});
			//fade in new image
			newImage.fadeIn(1000);
		 }
	}); // end click
	$('#b_gallery a:first').click();
}

function popitup(url) {
	winatt = 'location=0,status=0,scrollbars=1, width=1000,height=600';
	newwindow=window.open(url,'popit',winatt);
	if (window.focus) {newwindow.focus()}
	return false;
}

/*
 * Escape from a frame if the site is opened in one
 */
function escape_frame() {
  if (top.location != location) {
    top.location.href = document.location.href;
    alert('Frame removed');
  }
}

/*
 * Remove header if viewed in a frame (after the page has loaded)
 */
function set_frame_view() {
	$(document).ready(function() {
	  if (top.location != location) {
	  	//we are in a frame - do whatever...
	  	//$('#headbackdrop').hide();
	  	$('#banner').hide();
	  	$('#banner1').hide();
	  	$('#navarea').hide();
	  	$('#infobar').hide();
	  	$('#footbackdrop').hide();
	  } else {
	  	$('#backdrop').addClass('backdropstyle');
	  }
	});

}
