function getPage(url){
	if(url == ''){
		window.location = "/enterpriseNew";
	}else{
		window.location= url;
	}
}

function goHome(){
	window.location = "/";
}


function showGalleryPic(strImg, strCaption) {
	openWindow("ViewImage.aspx?img=" + strImg + "&caption=" + strCaption, 650, 650);
}

// JavaScript Document
function viewSlideShow(fsId) {
	openWindow("ImageScroller.aspx?fsId=" + fsId, 900, 700);
}

function viewImage(strImage) {
	openWindow(strImage, 600, 600);
}

function openWindow(url, w, h) {
  defaultWidth = 400;
  defaultHeight = 400;
  winWidth  = (w == null) ? defaultWidth  : w;
  winHeight = (h == null) ? defaultHeight : h;   
  winLeft = ((screen.availWidth  / 2) - 30) - (winWidth / 2);
  winTop  = ((screen.availHeight / 2) - 30) - (winHeight / 2);
  window.open(url, "", "width=" + winWidth + ", height=" + winHeight + ", left=" + winLeft + ", top=" + winTop + ", resizable=no, scrollbars=no");
} 

var popUpWin=0;
function popUpWindow(URLStr, width, height) {
	if(popUpWin) {
		if (!popUpWin.closed) popUpWin.close();
	}
	
	popUpWin = open(URLStr, 'popup', 'width=' + width + ',height=' + height + ',scrollbars=yes,status=yes,resizable=yes');
}
function Point(x, y) {
	this.x = x;
	this.y = y;
}

function getElementLocation(elementObj) {
	var cumulativeLeft = 0;
	var cumulativeTop  = 0;
	var elementToLocate = elementObj;
	cumulativeLeft = elementToLocate.offsetLeft;
	cumulativeTop  = elementToLocate.offsetTop;
	objParent = elementToLocate.offsetParent;

	while(objParent != null && objParent.tagName.toLowerCase() != "body"){
		cumulativeLeft  += objParent.offsetLeft;
		cumulativeTop   += objParent.offsetTop;
		objParent = objParent.offsetParent;
	}

	return new Point(cumulativeLeft, cumulativeTop);
}


function setMenuLocation() {
  var menu = document.getElementById("menu");
  var parentTag = document.getElementById("menuLocation");
  var mloc = getElementLocation(parentTag);
  menu.style.left = mloc.x;
  menu.style.top = mloc.y + 30;
}


var menuStatus = "closed";

function doMenu(img) {
  var menu = document.getElementById("menu");
  // open menu
  if (menuStatus == "closed") {
    menu.style.visibility = 'visible';
    menuStatus = "open"
    swapImage(img, "images/menuProductsH.gif");
  // close menu
  } else {
    menu.style.visibility = "hidden";
    menuStatus = "closed"
    swapImage(img, "images/menuProducts.gif");
  }
}

function hideMenu() {
	var menu = document.getElementById("menu");
    menu.style.visibility = "hidden";
    menuStatus = "closed"
    swapImage(document.getElementById('menuLocation'), "images/menuProducts.gif");
}

function highlight(row) {
  row.className = "highlight";
}

function unhighlight(row) {
  row.className = "";
}

// shows info message and fowards to a url
function go(url, message, style){
  var defualtStyle = "header";
  var defualtMessage ="loading...";
  if(style == null || style == ""){ style = defualtStyle; }
  if(message == null || message == ""){ message = defualtMessage; }  
  if(url != null && url != ""){
    showInfoMessage(message, style);
  }
  window.location = url;
}

// swaps an image src with a specified image at the provided path
function swapImage(img, path){
  if(img != null){
    img.src = path;
  } else {
    alert("could not swap image");
  }
}

//Lightbox Functions...
function LightBoxYcpFlv(flvUrl, ifWidth, ifHeight){
	var anchorTag = document.getElementById("lightBoxInitiator");
	anchorTag.href = '/pages/lightbox.aspx' + "?iframe&flvSource=" + flvUrl + "&width=" + ifWidth + "&height=" + ifHeight;
	$("#lightBoxInitiator").fancybox({
		'overlayShow'			: false,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
		frameWidth			:	ifWidth,
		frameHeight			:	(ifHeight)
	}).trigger('click');
}

function LightBoxFlv(flvUrl, ifWidth, ifHeight){
	var anchorTag = document.getElementById("lightBoxInitiator");
	anchorTag.href = '/pages/lightboxFLP.aspx' + "?iframe&flvSource=" + flvUrl + "&width=" + ifWidth + "&height=" + ifHeight;
	$("#lightBoxInitiator").fancybox({
		'overlayShow'			: false,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
		frameWidth			:	ifWidth,
		frameHeight			:	(ifHeight)
	}).trigger('click');
}
function LightBoxHTML(ifWidth, ifHeight){
	var anchorTag = document.getElementById("lightBoxInitiator");
	anchorTag.href = '/pages/lightbox.aspx' + "?iframe&itemId=" + itemId;
	$("#lightBoxInitiator").fancybox({
		'overlayShow'			: false,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
		frameWidth			:	ifWidth,
		frameHeight			:	ifHeight
	}).trigger('click');
}
function LightBoxSwf(swfUrl, ifWidth, ifHeight){
	var anchorTag = document.getElementById("lightBoxInitiator");
	anchorTag.href = '/pages/landingPages/lightbox.aspx' + "?iframe&swfSource=" + swfUrl + "&width=" + ifWidth + "&height=" + ifHeight;
	$("#lightBoxInitiator").fancybox({
		'overlayShow'			: false,
		'zoomSpeedIn'			: 600,
		'zoomSpeedOut'			: 500,
		'easingIn'				: 'easeOutBack',
		'easingOut'				: 'easeInBack',
		frameWidth			:	ifWidth,
		frameHeight			:	(ifHeight)
	}).trigger('click');
}
