	var lastdivid = "";
	
	function HideContent(d) {
		if(d.length < 1) { return; }
		document.getElementById(d).style.display = "none";
	}
	function ShowContent(d) {
		if(d.length < 1) { return; }
		HideContent(lastdivid);
	
		document.getElementById(d).style.left = getPosition(document.getElementById('mainimage'),"left") + "px";
		document.getElementById(d).style.top = getPosition(document.getElementById('mainimage'),"top") + "px";
		document.getElementById(d).style.display = "block";
		
		MoveScrollUp(d);
		SetLastDivId(d);
	}
	function ReverseContentDisplay(d) {
		if(d.length < 1) { return; }
		if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; }
		else { document.getElementById(d).style.display = "none"; }
	}
	/*function HideAll(d,e) {
		for (var x = 1; x <= e; x++) {
			if(document.getElementById(d+x).style.display == "block") { document.getElementById(d+x).style.display = "none"; }
			//document.getElementById(d + x).style.display = "none";
		}
	}*/
	function SetLastDivId(e) {
		lastdivid = e;
	}
	function MoveScrollUp(d) {
    	document.getElementById(d).scrollTop = 0;
    }
	function GetPositionX(e) {
		return document.getElementById(e).x;
	}
	
	// get obj position
	function getPosition(obj, e){  
       var left = 0;  
       var top  = 0;  
    
       while (obj.offsetParent){  
           left += obj.offsetLeft;  
           top  += obj.offsetTop;  
           obj   = obj.offsetParent;  
       }  
       left += obj.offsetLeft + 5;  
       top  += obj.offsetTop + 5;  
	   
	   if( e == "left" ) { return left };
	   if( e == "top" ) { return top };
    
   } 
   
   // Cookie
   function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ';', len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}

function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+'='+escape( value ) +
		( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
		( ( path ) ? ';path=' + path : '' ) +
		( ( domain ) ? ';domain=' + domain : '' ) +
		( ( secure ) ? ';secure' : '' );
}

function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + '=' +
			( ( path ) ? ';path=' + path : '') +
			( ( domain ) ? ';domain=' + domain : '' ) +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}

// FUNCTION NEW WINDOW
// height - Defines the height of the window in pixels. Percentage values don't work.
// width - Defines the width. Again, you'll have no joy with percentages.
// left - Supported by version 4 browsers and above, this sets how far removed the window appears from the left of the screen. In pixels.
// top - Partner to left, this pushes the window off the top of the screen.
// resizable - Set to true or false, this may allow the user to resize the window.
// scrollbars - Another Boolean value, this adds scrollbars to the new window. If your content may be longer then the dimensions you've specified, make sure this is set to yes.
// toolbar - Specifies whether the basic back/forward toolbar should be visible. If there are links to follow in your new page, set this to yes.
// menubar - Specifies whether the main toolbar (File, Edit, ...) is shown.
// location - Specifies whether the location toolbar (address bar) is shown.
// status - Specifies whether the new window can have a status bar. Best set to yes. For security reasons, Mozilla-based browsers always show the status bar.
// directories - Specifies whether the directories toolbar is shown (Links toolbar in IE).
// fullscreen - Internet Explorer-only Boolean attribute which may open the window in fullscreen. It's annoying — don't use it.
// dependent - Netscape 4-only attribute which makes the popup dependent on the status of the main window. If the main window is closed, the popup closes with it.
// screenX & screenY - Old Netscape attributes for defining the window's position on the page. Use left and top in their place. 
var newwindow;
function winpopup(url,name,params)
{
	//newwindow=window.open(url,'name','height=400,width=200,menubar=no,location=no,toolbar=no');
	newwindow=window.open(url,name,params);
	if (window.focus) {newwindow.focus()}
}

