﻿var isIE, isNs;
isIE = false;
isNs = false;
if (navigator.appName == "Netscape") {isNs=true;}else{isIE= true;}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function showhide(object)
{
	var obj = MM_findObj(object);
  if (obj != null)
	{
    obj = (obj.style) ? (obj.style):obj;
    
    if (obj.display == "block")
		obj.display = "none";
	else
		obj.display = "block";
		
	if (obj.visibility == "visible")
		obj.visibility = "hidden";
	else
		obj.visibility = "visible";
   }
  }

function HighLightListBoxBooking()
{
    var obj = MM_findObj('lbDetails');    
    for (var i = 0; i < obj.options.length; i++)
    {
        obj.options[i].selected = true;
    }    
}  
function AddBooking()
{
    var obj1 = MM_findObj('lbDetails');    
    var obj2 = MM_findObj('rbProductDuration'); 
    var length = obj1.options.length;   
    var i = 0;        	
	var productDurations;
	try
	{
	    if (obj2.length > 1)
	    {	     
    	    for (i = 0; i < obj2.length; i++)
	        {
     	       if (obj2[i].checked)
        	        break;
    	    }
    	
    	    obj2 = obj2[i];
    	}
    	else
    	{     				
    	    obj2 = obj2;    	    
    	}
		
	}
	catch(err)	
	{	    	    	    
		obj2 = obj2;
	}
	
	try
	{
		productDurations = obj2.value.split('#');
	}
	catch(err)
	{
		productDurations = obj2[i].value.split('#');
	}
    obj1.options[length] = new Option(productDurations[3], productDurations[0] + "#" + productDurations[1] + "#" + productDurations[2], false, false);
    
}

function RemoveBooking()
{
    var obj = MM_findObj('lbDetails');
    if (obj.selectedIndex > -1)
    {
        obj.options[obj.selectedIndex] = null;
    }
    
}