function get_by_id(id)
{
	element = null;

	if ( document.getElementById )
	{
		element = document.getElementById(id);
	}
	else if ( document.all )
	{
		element = document.all[id];
	}
	else if ( document.layers )
	{
		element = document.layers[id];
	}

	return element;
}

function clear_value(myid,deflt)
{
	
	if ( deflt )
	{
		
		if ( deflt == myid.value )
		{
			
			myid.value='';
		}
	}
	else
	{
		myid.value='';
	}
}

function reset_value(myid,deflt)
{
	if ( myid.value == '' )
	{
		myid.value = deflt;
	}
}

function show_hide(name)
{
	div1 = null;

	div1 = get_by_id(name);

	if ( div1 )
	{
	 	if ( div1.style.display == 'none' )
	 	{
	 		div1.style.display = '';

	 		set_cookie( 'hdsh_'+name, 1, 365 );
	 	}
	 	else
	 	{
	 		div1.style.display = 'none';

	 		set_cookie( 'hdsh_'+name, 0, 365 );
	 	}

	 	//Effect.toggle( div1, 'slide' );
	}
}

function ShowRightResultDetails( divId ,divId1){
	document.getElementById(divId).style.display = "block";
	document.getElementById(divId1).style.display = "none";
}
function ShowMessageBox( divId,divId1){
	document.getElementById(divId).style.display = "block";
	document.getElementById(divId1).style.display = "none";
	document.getElementById(divId1+"1").style.display = "block";
}
function HidMessageBox( divId,divId1){
	document.getElementById(divId).style.display = "none";
	document.getElementById(divId1).style.display = "block";
	document.getElementById(divId1+"1").style.display = "none";
}

//var SearchAttributeIdArr=new Array();
//alert(SearchAttributeIdArr);
function checkCheckBoxes(cid,mainAttId,SubAttId) {

 if(document.getElementById("LeftSubAtt"+cid+"-"+mainAttId+"-"+SubAttId).checked==true){
        //check for category id
		  if(SearchAttributeIdArr.length!=0){
		 
			  var SearchAttributeIdStr= SearchAttributeIdArr.toString()
			   var oldCatVal=   SearchAttributeIdStr.split("-",1);
			
			 if(oldCatVal[0]!=cid){
			   SearchAttributeIdArr=[];
			 }
		  }
		  
		SearchAttributeIdArr.push(cid+"-"+mainAttId+"-"+SubAttId);
		 
		  }else{
		  
		  // InputcatIdArr.pop(cid);
			  for ( var i in SearchAttributeIdArr )
				{
				
					if(SearchAttributeIdArr[i]==cid+"-"+mainAttId+"-"+SubAttId){
						SearchAttributeIdArr.splice(i,1);
			
					}
		      }
		  }
		  
//alert(SearchAttributeIdArr);

}	
function UpdateResults(baseurl,cid){

if(SearchAttributeIdArr.length==0){
   //   alert("please select value");
   window.parent.location.href=baseurl+"search.php?setfilter=yes";
 }else{
   window.parent.location.href=baseurl+"search.php?SearchAttributeIdArr="+SearchAttributeIdArr+"&cid="+cid+"&setfilter=yes";
   
	 //GetAttributeSearchList(baseurl,SearchAttributeIdArr,cid);
	     
	       //  document.product.submit();
	  
 } 

}
