var TopLinksDropDown = {
	prevLinkId:null,
	toggleDropDown:function(linkId, e){
		if (!e) var e = window.event;
		if(e)
			e.cancelBubble = true;
		if (e.stopPropagation) e.stopPropagation();
		
		if(linkId != '' && linkId != TopLinksDropDown.prevLinkId)
			TopLinksDropDown.hidePreviousLink();
		//Remember the id
		if(linkId=='')linkId = TopLinksDropDown.prevLinkId;
		else TopLinksDropDown.prevLinkId = linkId;
		
		var sender = $('#'+linkId);
		var drop = sender.next();
		
		var leftOffset = sender.offset().left - drop.width() + sender.width() + 11;
		drop.offset({left:leftOffset});
		
		if(drop.css('display') == 'none')
		{ 
			$(document).click(TopLinksDropDown.documentClickHandler);
			drop.show();
		}
		else
		{
			$(document).unbind('click', TopLinksDropDown.documentClickHandler);
			drop.hide();
		}
					
	},
	
	hidePreviousLink:function(){
	
		var sender = $('#'+TopLinksDropDown.prevLinkId);
		var drop = sender.next();
		drop.hide();
		$(document).unbind('click', TopLinksDropDown.documentClickHandler);
	},
	
	documentClickHandler:function(e){
		TopLinksDropDown.toggleDropDown('', e);
	}
}
	

function showFlash() {
	$('.flashscript-container').show();
}

function showLoginWindow(){
	$('.login-control').jqm({modal: true});
	$('.login-control').jqmShow();
}

function showColorBlueWindow(){
	$('.color-blue').jqm({modal: true});
	$('.color-blue').jqmShow();
}

function showColorPurpleWindow(){
	$('.color-purple').jqm({modal: true});
	$('.color-purple').jqmShow();
}

function showColorRedWindow(){
	$('.color-red').jqm({modal: true});
	$('.color-red').jqmShow();
}

function showColorBrownWindow(){
	$('.color-brown').jqm({modal: true});
	$('.color-brown').jqmShow();
}

function showColorOrangeWindow(){
	$('.color-orange').jqm({modal: true});
	$('.color-orange').jqmShow();
}

function showColorYellowWindow(){
	$('.color-yellow').jqm({modal: true});
	$('.color-yellow').jqmShow();
}

function showColorGrayWindow(){
	$('.color-gray').jqm({modal: true});
	$('.color-gray').jqmShow();
}

function showColorWhiteWindow(){
	$('.color-white').jqm({modal: true});
	$('.color-white').jqmShow();
}
