/*
//////////////////////////////////////////////////////////////
//															//
//		Vision Source										//
//		Created by Ben Maynard copyright 2005				//		
//		Email: ben@visionsource.org							//
//		URL: http://www.visionsource.org					//
//		Created: 13th November 2005							//
//		$Id: vs_global.js 47 2007-12-10 11:41:58Z Ben $//
//															//
//----------------------------------------------------------//
//															//
//		Script: vs_admin_global.js							//
//		written by: Ben Maynard								//
//															//
//////////////////////////////////////////////////////////////
*/

function confirm_action()
{

	userconfirm = window.confirm("Are you sure you wish to carry out this action?");
		
		if (check_confirm(userconfirm) == true)
		{
			return true;
		}
	
		else
		{
			return false;
		}
}

function check_confirm(userconfirm)
{

	if (userconfirm == true)
	{
		return true;
	}
	
	else
	{
		return false;
	}
}

function confirm_action()
{

	userconfirm = window.confirm("Are you sure you wish to carry out this action?");
		
		if (check_confirm(userconfirm) == true)
		{
			return true;
		}
	
		else
		{
			return false;
		}
}

function check_confirm(userconfirm)
{

	if (userconfirm == true)
	{
		return true;
	}
	
	else
	{
		return false;
	}
}

function go_to( url )
{
	window.open( url, '_blank' );
}

function image_rollover(image_name)
{
		if ( current != image_name )
		{
			document.getElementById('' + image_name + '').src = skinurl + 'images/' + image_name + '_over.jpg';
		}
}

function image_restore(image_name)
{
		if ( current != image_name )
		{
			document.getElementById('' + image_name + '').src = skinurl + 'images/' + image_name + '_normal.jpg';
		}
}

function image_rollover_go(id)
{
		document.getElementById('go_' + id + '').src = skinurl + 'images/go_over.jpg';
}

function image_restore_go_1(id)
{

	document.getElementById('go_' + id + '').src = skinurl + 'images/go_normal_1.jpg';
}

function image_restore_go_2(id)
{

	document.getElementById('go_' + id + '').src = skinurl + 'images/go_normal_2.jpg';
}

function init()
{
	if ( current != '' )
	{
		document.getElementById('' + current + '').src = skinurl + 'images/' + current + '_current.jpg';
	}
	

	if ( TransMenu.isSupported() )
	{
		TransMenu.initialize();

		// hook all the highlight swapping of the main toolbar to menu activation/deactivation
		// instead of simple rollover to get the effect where the button stays hightlit until
		// the menu is closed.
		
		
		products.onactivate = function() { document.getElementById("range_id").className = "hover"; };
		products.ondeactivate = function() { document.getElementById("range_id").className = ""; };
		
	}
}

// Set the horizontal and vertical position for the popup



PositionX = 100;

PositionY = 100;



// Set these value approximately 20 pixels greater than the

// size of the largest image to be used (needed for Netscape)



defaultWidth  = 500;

defaultHeight = 500;



// Set autoclose true to have the window close automatically

// Set autoclose false to allow multiple popup windows



var AutoClose = true;



// Do not edit below this line...

// ================================

if(parseInt(navigator.appVersion.charAt(0))>=4)

{

	var isNN=(navigator.appName=="Netscape")?1:0;

	var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}

	var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;

	var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;

	function popImage(imageURL,imageTitle)

	{

		if (isNN)

		{

			imgWin=window.open('about:blank','',optNN);

		}

		if (isIE)

		{

			imgWin=window.open('about:blank','',optIE);

		}

		with (imgWin.document)

		{

			writeln('<html><head><title>Loading...</title><style>body{margin:5px;background: #615b75}</style></head>');

			writeln('<sc'+'ript>');

			writeln('var isNN,isIE;');

			writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');

			writeln('isNN=(navigator.appName=="Netscape")?1:0;');

			writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');

			writeln('function reSizeToImage(){');

			writeln('if (isIE){');

			writeln('window.resizeTo(100,100);');

			writeln('width=100-(document.body.clientWidth-(document.images[0].width + 40));');

			writeln('height=100-(document.body.clientHeight-(document.images[0].height + 40));');

			writeln('window.resizeTo(width,height);}');

			writeln('if (isNN){');

			writeln('window.innerWidth=document.images["George"].width;');

			writeln('window.innerHeight=document.images["George"].height;}}');

			writeln('function doTitle(){document.title="'+imageTitle+'";}');

			writeln('</sc'+'ript>');

			if (!AutoClose) writeln('</head><body bgcolor=000000 scroll="no" onload="reSizeToImage();doTitle();self.focus()">')

			else writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');

			writeln('<div align="center"><img name="George" src="'+imageURL+'" /></div><p><div align="right"><a href="javascript: window.close();" style="font-size:10; color:#575757; font-family: Verdana; text-decoration: underline;">close window</a></div></p></body></html>');

		close();

	}

}

function submit_layout_form()
{
	theform = document.getElementById('layout_form');
	theform.submit();
}

function view_layout( id )
{
	theform = document.getElementById('layout_form');
	theform.action = url + '/index.php?id=layouts&lid=' + id;
	theform.submit();
}