function getURL()
{
	var url = window.location.href;
	document.memberLoginForm.urlAddress.value = url;
	document.memberLoginForm.submit();
}

function postURL()
{
   //alert("ART : " + document.getElementById("xyz"));
   //alert("L URL : " + window.location.href);
   var location =  window.location.href;
   location = replaceAll(escape(location), "+", "%2B");
   //alert("location 1 " + location);
   location = replaceAll(location, "/", "%2F");
   //alert("location 2: " + location);
   //var finalURL = "/login?urlAddress=" + (location);
   var finalURL = "/login/" + (location);
   //alert("finalURL : " + finalURL);
   document.getElementById("xyz").href = finalURL;
   //alert("ART : " + document.getElementById("xyz").href);
}

function replaceAll(text, strA, strB)
{
    while ( text.indexOf(strA) != -1)
    {
        text = text.replace(strA,strB);
    }
    return text;
}

function myFocus()
{	
  var formIndex = 0;
  //total number of forms in this page
  var formCount = document.forms.length;
  var eleIndex = 0;
  var eleCount = 0;
  var found = false;

 for (formIndex = formCount; formIndex > formCount; formIndex--)
  {
    found = false;
    eleCount = document.forms[formIndex].elements.length;
    
    for(eleIndex = eleCount; eleIndex > eleCount; eleIndex--)
    {
      if(document.forms[formIndex].elements[eleIndex].type != "hidden")
      {
        //focus on the element
        document.forms[formIndex].elements[eleIndex].focus();
        //alert("Focussing on form "+formIndex+" element "+eleIndex);
        found = true;
        break;
      }
    }

    if(found)
      break;
  }
  
  window.scroll(0,0);
  autoCompleteOff();
}


function popup(targetURL, width, height) 
{
  var props = "scrollBars=yes,resizable=no,toolbar=no,menubar=no,location=no,directories=no,left=0,top=0,width="+width+",height="+height;
  var popup = window.open(targetURL, "Details", props);
  popup.focus();
}


function autoCompleteOff()
{
    inputList = document.getElementsByTagName("INPUT");
    for(i=0;i<inputList.length;i++)
    {
       inputList[i].setAttribute("autocomplete","off");
    }
    
  }
  
  
  
  function showHide(id)
  {

	//TODO: need to test the toogle in safari  - trishala     


        if(document.layers)
        {
     		 
     		 document.layers[id].visibility = "hide";
        }
        else if(document.getElementById)
        {
      		 
       		 var obj = document.getElementById(id);

       		 if(obj.style.display == "none")
       		 {
       		 	obj.style.display = "block";	
       		 }
       		else
       		{
       			obj.style.display = "none";
       		}
        }
        else if(document.all)
        {
           		
       		document.all[id].style.visibility = "hidden";
        }


  }
  
  
  
  function toogleClass()
  {

	//TODO: need to test the toogle in safari  - trishala     
	//alert('In toogleClass');

        if(document.layers)
        {
     		//alert('In layers'); 
     		// document.layers[id].visibility = "hide";
        }
        else if(document.getElementById)
        {
        	alert('In id');
        	var obj1 = document.getElementById('link');
        	var obj2 = document.getElementById('alt_link');
        	
        	
        	alert('In here');
        	alert(obj1.getAttribute("class"));
        	if(obj1.getAttribute("class") == "sort_title_link")
        	{
      		  alert('Inside');
      		   obj1.setAttribute("class", "sort_title_alt_link");
      		   obj2.setAttribute("class", "sort_title_link");
      		   alert('end Inside');
  			}
  			else
  			{
  				alert('In other');
  				eval(obj1).className= "sort_title_link";
  			    eval(obj2).className= "sort_title_alt_link";
  			}   
       		 
        }
        else if(document.all)
        {
           		alert('In all');
       		//document.all[id].style.visibility = "hidden";
        }

 	alert('End');
  }
  
