﻿
////////////////////////////////////////////////////////////////////
/// GRLmobile - common custom JS
/// (c) Webo, 2010
////////////////////////////////////////////////////////////////////


/// PopWin(url, winname, width, height)
/// return: none
function PopWin(url, winname, width, height)
{
	window.open(url, winname, 'toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=' + width + ',height=' + height);

}

function openTab(obj, id){
      var parentObj = document.getElementById("tab");
	  var childArray = parentObj.getElementsByTagName("table");
	  var imgArray = document.getElementById("img").getElementsByTagName("img");
      var tableArray = new Array();
	  var k = 0;
	  for (j=0; j<childArray.length ; j++){
		    if (childArray[j].getAttribute('name') == "tableTab")
		    {
				tableArray[k] = childArray[j];
				k++;
		    }
		 }

		 //alert(tableArray.length);
	   for (i=0; i<tableArray.length ; i++){   
		 tableArray[i].style.display = "none";
					  if (imgArray[i].src.indexOf("_off") == -1)
					  {
						 var new_src = imgArray[i].src.split(".jpg")[0]+"_off.jpg";
						 imgArray[i].src = new_src;
					  }
	  }	
	  
	  document.getElementById(id).style.display = "block";
	  document.getElementById(id).style.width = "737px" 

     obj.src = obj.src.split("_off")[0] + ".jpg";
}

function swapimg(obj)
{
  var imgobj = obj.getElementsByTagName("img")[0];
  var strsrc = imgobj.src;
  if (strsrc.indexOf("_off") != -1)
    {
	    var new_src = strsrc.split("_off")[0]+"_on.gif";
		imgobj.src = new_src;
    }
  else
	{
        var new_src = strsrc.split("_on")[0]+"_off.gif";
		imgobj.src = new_src;

	}
}





