function show_tabs(tabid,flag,div_id,dbtabid)
{
    // curent_tab is used for drag/drop in TabList
	curent_tab=dbtabid	
	if(tabid==l_id){ return;}//exit from function if click on pressed tab	
	if(tabid==1) { document.all("fimg_tab1").className='office_mainbtnupright';}
	else {document.all("fimg_tab1").className='office_mainbtnright';}	
	
	/////////////////////////////////////////////////////////////////////
	// Set previous selected Tab state		
	switch (l_flag)
	{
		case "f": // first tab
		{ 
			document.all("limg_tab" + l_id).className='office_btnleftright';
			break;
		}
		case "m": // middle tabs
		{
			document.all("limg_tab" + l_id).className='office_btnleftright';
			document.all("limg_tab" + (l_id-1)).className='office_btnleftright';
			break;
		}
		case "l":// last tab
		{
			document.all("limg_tab" + l_id).className='office_btnleft';
			document.all("limg_tab" + (l_id-1)).className='office_btnleftright';
			break;
		}
	}
	// Change background class and link class 
	document.all("td_tab" + l_id).className='office_btnbg'
	document.all("a_tab" + l_id).className="button";
	/////////////////////////////////////////////////////////////////////
	// Set new selected Tab state		
	switch (flag)
	{
		case "f":
		{
			document.all("limg_tab" + tabid).className='office_btnuprightleft';
			break;
		}
		case "m":{
			document.all("limg_tab" + tabid).className='office_btnuprightleft';
			document.all("limg_tab" + (tabid-1)).className='office_btnupleftright';
			break;
		}
		case "l":
		{
			document.all("limg_tab" + tabid).className='office_btnupleft';
			document.all("limg_tab" + (tabid-1)).className='office_btnupleftright';
			break;
		}
	}
	// Change background class and link class 
	document.all("td_tab" + tabid).className='office_btnupbg';
	document.all("a_tab" + tabid).className="button_p";
	//save current id to previous id
	l_id=tabid;
	//save current state to previous state
	l_flag=flag;
	
	// Show/hide divs
	var v_tab_obj=document.all(div_id)
	var h_tab_obj=document.all(l_div_id)
	if(v_tab_obj.style.display=="none")
	{
		v_tab_obj.style.display="";//show div
		h_tab_obj.style.display="none";
	}
	l_div_id =div_id//save current div		
	
	document.Form1.current_tabid.value=tabid	
}

//function relevant to checkbox view price on page
function checksimulation(c_obj,hidden_id)
{	        
	var hiddenObj=document.getElementById(hidden_id)
	hiddenObj.value='0'
	if(c_obj.checked==true){hiddenObj.value='1'}
}

function timeChanged(tabPrefix,hidden_id)
{
    var hiddenObj=bsGetASPElementByID(tabPrefix,hidden_id)
    var hour=bsGetASPElementByID(tabPrefix,"BSmart_"+hidden_id+"_h")
    var minute=bsGetASPElementByID(tabPrefix,"BSmart_"+hidden_id+"_m")
    hiddenObj.value=hour.options[hour.selectedIndex].value+":"+minute.options[minute.selectedIndex].value			    
}
	
//***** show first tab div *****//
function initTabs(f_divid)
{		
	if(f_divid=="")	return false;
	var v_tab_obj=document.all(f_divid);
	if(v_tab_obj.style.display=="none") v_tab_obj.style.display="";//show div			
	l_div_id=f_divid;
}

// ------------------------------------------------------
// Style, Content Structure or Color-Set Tab
// ------------------------------------------------------
// Select Style, Content Structure or Color-Set
// controlName id the Tab prefix (part of each Form-field name)
function selectStyle(styleID,objField,tabID)
{			
	var controlName=eval("document.Form1.Tab_Styles"+tabID+".value")+"_"
	// Get current selection
	var currentID=eval("document.all('"+controlName+objField+"').value")
	// Set the new selection
	eval("document.all('"+controlName+objField+"').value="+styleID)
	// Replace selection
	eval("document.all('style"+currentID+"').bgColor='white'")
	eval("document.all('style"+styleID+"').bgColor='#0368FA'")			
}

function upateCheckBoxList(controlName,maxID)
{
  var hiddenChkBoxList= document.all(controlName)
  var fullValList=document.all(controlName+"_bsmartvals").value.split(",");  
  hiddenChkBoxList.value=""
  // Get current selection
  var currentObj,i
  for (i=0;i<fullValList.length;i++)
  {    
    currentObj=eval("document.all('"+controlName+"_bsmart_"+i+"')")    
    if (currentObj.checked) hiddenChkBoxList.value=hiddenChkBoxList.value+","+fullValList[i]
  }
  hiddenChkBoxList.value=hiddenChkBoxList.value.substring(1,hiddenChkBoxList.value.length)
  //alert(hiddenChkBoxList.value)
}
// ------------------------------------------------------
// Discounts Tab
// ------------------------------------------------------
// Select Discount (for deletion)

