

// ********** global menu vars **********
var mainMenu		= "menu";
var globalSection	= "";
var globalSubSection= "";

// ********** Load Menu ; body **********
function loadMenu()
{
	new TreeMenu(mainMenu); 
	setTimeout("document.getElementById('menu-start').style.display = 'none'; document.getElementById('menu-wraper').style.display = 'inline';", 100);
}


// ********** Open Box **********
function openBox(oID, mode)
{
	if(mode)
	    document.getElementById(oID).style.display = "inline";
    else
        document.getElementById(oID).style.display = "none";
}

// ********** Open Section ; body **********
function openSection(oID)
{
	document.getElementById(mainMenu + "-" + oID + "-section").style.display = "block";
	document.getElementById(mainMenu + "-" + oID).className = "section-open";
}

// ********** Hover Section ; menu **********
function hoverSection(oID, bHover)
{

	if(globalSection == oID) return;

	if (bHover)
	{
		document.getElementById(mainMenu + "-" + oID).className = "section-hov";
	}
	else
	{
		document.getElementById(mainMenu + "-" + oID).className = "section";
	}
}

// ********** Close Section ; menu engine **********
function closeSection(oID)
{
	document.getElementById(oID).className = "section-hov";
}

// ********** Get Section Class Name; menu **********
function getClassName(oID)
{
	return document.getElementById(mainMenu + "-" + oID).className;
}


// ********** Contact SECTION ; contact.asp **********
function checkContact()
{
	var objForm = document.forms.theForm;
	var objCurrent;
	
		
	var objCurrent = objForm.FirstName;
	if(isWhitespace(objCurrent.value))
	{
		changeClass(objCurrent.id,'errField standardWidth');
		alert("Please enter First Name!");
	    objCurrent.focus();
	    return false;
	}
	else
	{
		changeClass(objCurrent.id,'standardField standardWidth');
	}
	
	var objCurrent = objForm.LastName;
	if(isWhitespace(objCurrent.value))
	{
		changeClass(objCurrent.id,'errField standardWidth');
		alert("Please enter Last Name!");
	    objCurrent.focus();
	    return false;
	}
	else
	{
		changeClass(objCurrent.id,'standardField standardWidth');
	}
		
		
	if (!check3Phone( 'phone1', 'phone2', 'phone3', true, true )) return false;
	
	var objCurrent = objForm.Email;
	if(isWhitespace(objCurrent.value))
	{
		changeClass(objCurrent.id,'errField standardWidth');
		alert("Please enter Email!");
	    objCurrent.focus();
	    return false;
	}
	else if(!isEmail(trim(objCurrent.value)))
	{
		changeClass(objCurrent.id,'errField standardWidth');
		alert("Please enter a valid E-Mail address, like: name@companyname.com!");
	    objCurrent.focus();
	    return false;
	}
	else
	{
		changeClass(objCurrent.id,'standardField standardWidth');
	}
	
	var objCurrent = objForm.Message;
	if(isWhitespace(objCurrent.value))
	{
		changeClass(objCurrent.id,'errField standardWidth');
		alert("Please enter Message!");
	    objCurrent.focus();
	    return false;
	}
	else
	{
		changeClass(objCurrent.id,'standardField standardWidth');
	}
	
		
	
	return true;
}


//resize image functions

function ResizePortfolioImage()
{
    var imgClientInfoImg = document.getElementById("imgClientInfoImage");
    
    if(imgClientInfoImg != null && imgClientInfoImg.width > 450)
    {    
        var imgMaxWidth = 450;
        var imgHeight = (imgMaxWidth * imgClientInfoImg.height) / imgClientInfoImg.width;
        
        imgClientInfoImg.width = imgMaxWidth;
        imgClientInfoImg.height = imgHeight;
    }
}


function ResizeQuotationImage()
{
    var imgHeadshot = document.getElementById("clientQuotation_imgHeadshot");
            
    if(imgHeadshot != null && imgHeadshot.width > 72)
    {       
        var imgMaxWidth = 72;
        var imgHeight = (imgMaxWidth * imgHeadshot.height) / imgHeadshot.width;
        
        imgHeadshot.width = imgMaxWidth;
        imgHeadshot.height = imgHeight;
    }
}







