var myOffset = -250;

var myMenu0 = new ypSlideOutMenu("menu0", "down", 0, 67, 180, 185);
var myMenu1 = new ypSlideOutMenu("menu1", "down", 0, 67, 190, 100);
var myMenu2 = new ypSlideOutMenu("menu2", "down", 0, 67, 160, 90);

myMenu0.onactivate = repositionMenu0;
myMenu1.onactivate = repositionMenu1;
myMenu2.onactivate = repositionMenu2;

function repositionMenu0()
{
        var newLeft0 = (getWindowWidth() / 2) + myOffset + 10;
        myMenu0.container.style ? myMenu0.container.style.left = newLeft0 + "px" : myMenu0.container.left = newLeft0;
}

function repositionMenu1()
{
        var newLeft1 = (getWindowWidth() / 2) + myOffset + 150;
        myMenu1.container.style ? myMenu1.container.style.left = newLeft1 + "px" : myMenu1.container.left = newLeft1;
}

function repositionMenu2()
{
        var newLeft2 = (getWindowWidth() / 2) + myOffset + 340;
        myMenu2.container.style ? myMenu2.container.style.left = newLeft2 + "px" : myMenu2.container.left = newLeft2;
}

function getWindowWidth()
{
        return window.innerWidth ? window.innerWidth : document.body.offsetWidth;
}

function toggleTable(el) {
	var myelement = document.getElementById(el);
	//var nameelement = document.getElementById(el + "-featurename");
	//var myimg = document.getElementById(el + "-img");

	if( !myelement.style.display || myelement.style.display == "none" ) {
		//myelement.style.display = "inline";
		
		if(navigator.userAgent.indexOf("Firefox") != -1)
			myelement.style.display = "table-cell";
		else
			myelement.style.display = "inline";
		
		//myelement.style.display = "table-cell";
		
		/*
		if(navigator.userAgent.indexOf("Firefox") != -1)
			myelement.style.display = "inline";
		else
			myelement.style.display = "table-cell";
		*/

		//myimg.src= "/_images/matrix/minus.gif";
		//nameelement.style.fontWeight = "bold";
	} else {
		myelement.style.display = "none";
		//myimg.src= "/_images/matrix/plus.gif";
		//nameelement.style.fontWeight = "normal";
	}
}

function CreateControl(DivID, CLSID, ObjectID,
                       WIDTH, HEIGHT, ALIGN, URL, BGCOLOR)
{
  var d = document.getElementById(DivID);
  d.innerHTML = '<object classid=' + CLSID + ' codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id=' + ObjectID + ' width=' + WIDTH + ' height=' + HEIGHT + '/><param name="movie" value=' + URL + '><param name="quality" value="high" ><param name="bgcolor" value=' + BGCOLOR + ' /><embed src=' + URL + ' quality="high" bgcolor=' + BGCOLOR + ' width=' + WIDTH + ' height=' + HEIGHT + ' name=' + ObjectID + ' align=' + ALIGN + ' allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
}

function setPointer(theRow, thePointerColor)
{
    if (thePointerColor == '' || typeof(theRow.style) == 'undefined') {
        return false;
    }
    if (typeof(document.getElementsByTagName) != 'undefined') {
        var theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        var theCells = theRow.cells;
    }
    else {
        return false;
    }

    var rowCellsCnt  = theCells.length;
    for (var c = 0; c < rowCellsCnt; c++) {
        theCells[c].style.backgroundColor = thePointerColor;
    }

    return true;
}

function setClass(theRow, thePointerClass)
{
    if (typeof(theRow.style) == 'undefined') {
        return false;
    }else{
		theRow.className=thePointerClass;
		return true;
	}
}

function loadQuickContact(action,name,phone,email,website,company,join_newsletter)
{
	var html = '<form action="'+action+'" method="post" id="quickContactForm">		\
						<label for="name">Name:<span class="error">*</span></label><input type="text" name="name" id="name" value="'+name+'" />		\
						<label for="company" style="width:200px;">Company Name:</label><input type="text" name="company" id="company" value="'+company+'" />		\
						<label for="phone">Phone:<span class="error">*</span></label><input type="text" name="phone" id="phone" value="'+phone+'" />		\
						<label for="email">Email:</label><input type="text" name="email" id="email" value="'+email+'" />\
						<label for="website">Website:</label><input type="text" name="website" id="website" value="'+website+'" /><br />\
						<table width="100%"><tr><td width="20" valign="top"><input style="width:auto;" type="checkbox" name="join_newsletter" value="1" id="quickJoinNewsletter"'+ (join_newsletter == 1 ? ' checked="checked"' : '') +' /></td><td><label for="quickJoinNewsletter" style="display:inline; width:auto; padding:0;">Keep me informed with the eLink Design Internet Marketing Newsletter.</label></td></tr></table>\
						<input type="submit" name="Submit" value="" style="height:17px;width:84px;background:url(images/submit_bt.gif) no-repeat; border:none;" />		\
						<input type="hidden" name="action" value="quick_contact" />		\
					</form>		\
					<div style="clear:both;"><!-- --></div>';
	jQuery('#quickContact').append(html);
}
