
var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;


function expand(s,divId,tdId,offsetWidth)
{
//alert(2);
  //var span = document.getElementById("cheeseSpan");
  var d = document.getElementById(divId);

  //span.className = "mainMenuTDHover";
  d.className = "menuHover";
  d.style.top = getTop(tdId);
  d.style.left = getLeft(tdId,offsetWidth);
}

function collapse(s,divId)
{
  //var span = document.getElementById("cheeseSpan");
  var d = document.getElementById(divId);

  //span.className = "mainMenuTDNormal";
  d.className = "menuNormal";
}
/*
function getTop(tdId){
	return (document.getElementById("Table1").offsetTop+document.getElementById(tdId).offsetHeight)+"px";
		  
}
*/
function getTop(tdId){
	var obj = document.getElementById(tdId);
	var curTop = obj.offsetTop;
	//alert(obj.offsetParent);
	while (obj.offsetParent != null) 
	{
		obj = obj.offsetParent;
		//alert(obj.offsetParent);
		curTop += obj.offsetTop;	
	}
	
	return curTop + document.getElementById("Table1").offsetTop-2;
}

function getLeft(tdId,offsetWidth){
	var obj = document.getElementById(tdId);
	var curleft = obj.offsetLeft;
	//alert(obj.offsetParent);
	while (obj.offsetParent != null) 
	{
		obj = obj.offsetParent;
		//alert(obj.offsetParent);
		curleft += obj.offsetLeft;	
	}
	
	return curleft - offsetWidth;
}






// Handle all the FSCommand messages in a Flash movie.
function map_DoFSCommand(command, args) {
	var mapObj = isInternetExplorer ? document.all.map : document.map;
	//
	// Place your code here.
	//
	//alert(command);
	if( command == "/farms/iris" )
	{
		command = "/farms/iris1";
	}
	 
	document.getElementById("farmId").value = command;
	document.Form1.submit();
	 //if (command == "Ron")
	  // document.location = "http://localhost/Hava/index.aspx?hava=ron";
}
// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub map_FSCommand(ByVal command, ByVal args)\n');
	document.write('	Call map_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}

function showLargeImage(obj)
{
  var imgSrc = obj.src;  
  var imgName = imgSrc.substring(imgSrc.lastIndexOf("/")+1,imgSrc.length);
  var imgPath = imgSrc.substring(0,imgSrc.lastIndexOf("/")+1);
  var bigImage = imgPath + "big/" + imgName;
  window.open(bigImage, "big",""); 
}


function showLargeArticleImage(obj)
{
  var imgSrc = obj.src;  
  var imgName = imgSrc.substring(imgSrc.lastIndexOf("/")+1,imgSrc.length);
  var imgPath = imgSrc.substring(0,imgSrc.lastIndexOf("/"));
  imgPath = imgPath.substring(0,imgPath.lastIndexOf("/")+1);
  var bigImage = imgPath + "big/" + imgName;
  window.open(bigImage, "big",""); 
}


function setLocation(id)
{
	var path = String(window.location);
	//alert(path);
	var pos = path.indexOf("&");
	var isDairy = path.indexOf("DairyViewer");
	var pos1 = path.indexOf("?");
	//alert(pos);
	
	if(pos != -1 && isDairy == -1)
	{
		path = path.substring(0,pos);
		window.location = path + "&mode=" + id;
	}
	else if( isDairy == -1)
	{
		window.location = path + "&mode=" + id;
	}
	else
	{
	//alert("d");
	    window.location = path.substring(0,pos) + "&mode=" + id + "&vm=2";
	//alert(window.location);
	}
	
}

var newwindow = '';

function popitup(url)
{
	if (!newwindow.closed && newwindow.location)
	{
		newwindow.location.href = url;
	}
	else
	{
		newwindow=window.open(url,'MoviePlayer','height=540,width=660');
		if (!newwindow.opener) newwindow.opener = self;
	}
	if (window.focus) {newwindow.focus()}
	return false;
}
