// JavaScript document for tonycollings.com (c) Tony Collings

// Nice presentation for the contact form
function checkClearValue(field, label){  
  if(field.value == label)
  {
	field.style.color = "#07074f";
    field.value = "";
  }
}

function checkFillValue(field, label){
  if(field.value.length == 0)
  {
	field.style.color = "#c8d1f2";
    field.value = label;
  }
  if(field.value == label)
  {
	field.style.color = "#c8d1f2";  
  }
}

// Panel functions, mostly for the menus and contact form
function showMenu(menu) 
{
	switch (menu) 
	{
	case "business":  
		var current_menu = document.getElementById(menu);
		var other_menu = document.getElementById('leisure');
		var content = document.getElementById('main_content');
		
		if(current_menu.style.display == "none")
		{
		current_menu.style.display = "";
	  	other_menu.style.display = "none";
		content.style.display = "none";
		}
		else
		{
		current_menu.style.display = "none";
	  	other_menu.style.display = "none";
		content.style.display = "";
		}
		
	break;	
	case "leisure": 
		var current_menu = document.getElementById(menu);
		var other_menu = document.getElementById('business');
		var content = document.getElementById('main_content');
		
		if(current_menu.style.display == "none")
		{
		current_menu.style.display = "";
	  	other_menu.style.display = "none";
		content.style.display = "none";
		}
		else
		{
		current_menu.style.display = "none";
	  	other_menu.style.display = "none";
		content.style.display = "";
		}
		
	break;
	}
}
function closePanel(panel)
{
	var panel = document.getElementById(panel);
	var content = document.getElementById('main_content');
	panel.style.display = "none";
	content.style.display = "";
}
function showForm(panel1,panel2)
{
	var panel1 = document.getElementById(panel1);
	var panel2 = document.getElementById(panel2);
	panel1.style.display = "";
	panel2.style.display = "";
}
function showGoogleMap()
{
	var panel = document.getElementById('google_maps');
	var overlay = document.getElementById('overlay2');
	panel.style.display = "";
	overlay.style.display = "";		
}


// Blur effect DXImageTransform only works in IE
function blurObject(myObj)
{
	var obj=document.getElementById(myObj);
	obj.style.filter = "progid:DXImageTransform.Microsoft.Blur(PixelRadius='10', MakeShadow='false', ShadowOpacity='0.25')";
}
  
// Detects Browser Size
function detectBrowserSize(){
	
	var obj=document.getElementById('wrapper');
	
	switch (screen.height) 
	{
		case 800: obj.style.height = "800px"; break;
		case 1024: obj.style.height = "1024px"; break;
		case 1200: obj.style.height = "1200px"; break;
		default: obj.style.height = "800px"; break;
	}
	
}

// OPENS NEW WINDOW
var newwindow;
function openWindow(url,name) {
// newwindow=window.open(url,name,'width='+width+',height='+height+', resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no');
newwindow=window.open(url,name,'width=850,height=650, resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no');
	if (window.focus) {newwindow.focus()}
}

function openWindowSizeable(url,name,width,height) {
// newwindow=window.open(url,name,'width='+width+',height='+height+', resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no');
newwindow=window.open(url,name,'width='+width+',height='+height+', resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no');
	if (window.focus) {newwindow.focus()}
}


// Closes windows
function closeWindow() {
  window.close();
}


function show_hide(id){
if (document.getElementById){
obj = document.getElementById(id);
if (obj.style.display == "none"){
obj.style.display = "";
} else {
obj.style.display = "none";
}
}
}


