function ShowPromotionFields()
{
    try
    {
        if(document.all('chAgree').checked)
        {
            document.all('fieldsBlock1').style.display='block';
            document.all('fieldsBlock2').style.display='block';
        }
    }
    catch(e){}
}    
function show_caption()
{	
	try
	{
	    document.getElementById("bottom_caption").innerHTML = SelectedCaption.replace( "{0}", SelectedItem );
	}
	catch(e){}
}

function t(id)
{
    try
    {	
	    SelectedId = id;		
	    show_caption();
	    document.getElementById("tc_frame" + SelectedTabIndex).src = TargetUrl + "&id=" + id + "&TabIndex=" + SelectedTabIndex;				
    }
    catch(e){}
}

function t2(id,item)
{
    try
    {	
	    SelectedId = id;
	    SelectedItem = item;
	    show_caption();
	    document.getElementById("tc_frame" + SelectedTabIndex).src = TargetUrl + "&id=" + id + "&TabIndex=" + SelectedTabIndex + "&t=" + new Date(); 								
    }
    catch(e){}
}

function tc_AfterSelectedTabChange(oWebTab, oTab, oEvent){				
	SelectedTabIndex = oTab.getIndex();					
	var tabItem = oWebTab.Tabs[SelectedTabIndex];
	TargetUrl = tabItem.getTargetUrl();				
	try
	{			
		show_caption();
	}
	catch(e){}
	document.getElementById("tc_frame" + SelectedTabIndex).src = TargetUrl + "&id=" + SelectedId + "&TabIndex=" + SelectedTabIndex;						
	
}

function ClientAgentSwitcher()
{
    try
    {
       // alert('asd');
       setIframeHeight('tc_frame' + SelectedTabIndex);
        //document.getElementById("tc_frame" + SelectedTabIndex).src = TargetUrl + "&id=" + SelectedId + "&TabIndex=" + SelectedTabIndex;
    }
    catch(e){}			    
}
		
function tc_InitializeTabs(oWebTab){			
	try
	{
	    SelectedTabIndex = (SelectedTabIndex-1)/2;					
	    var tabItem = oWebTab.Tabs[SelectedTabIndex];
	    TargetUrl = tabItem.getTargetUrl();			
	    show_caption();
	    document.getElementById("tc_frame" + SelectedTabIndex).src = TargetUrl + "&id=" + SelectedId + "&TabIndex=" + SelectedTabIndex;										
	}
    catch(e){}
}

function getDocHeight(doc) 
{
    try
    {
	    var docHt = 0, sh, oh;				
	    if (doc.height) docHt = doc.height;
	    else if (doc.body) {
		    if (doc.body.scrollHeight) docHt = sh = doc.body.scrollHeight;
		    if (doc.body.offsetHeight) docHt = oh = doc.body.offsetHeight;
		    if (sh && oh) docHt = Math.max(sh, oh);
	    }
	}
    catch(e){}    
	return docHt;
}

function setIframeHeight(iframeName) 
{	
    try
    {			
	    var iframeWin = window.frames[iframeName];				
	    var iframeEl = document.getElementById? document.getElementById(iframeName): document.all? document.all[iframeName]: null;
	    if ( iframeEl && iframeWin ) 
	    {
		    // helps resize (for some) if new doc shorter than previous  
		    //iframeEl.style.height = "auto"; 					
		    //alert(iframeWin.location);						
		    var docHt = getDocHeight(iframeWin.document);					
		    // need to add to height to be sure it will all show
		    if (docHt) iframeEl.style.height = docHt + "px";
	    }				
	    //For tab control
	    //if(docHt<250) docHt=250;
	    document.getElementById(iframeName).style.height = docHt + "px";	
	}
    catch(e){}		
}
function ctsLoad()
{
    try{ ClientAgentSwitcher();}
    catch(e){}
    
    try{ setAmount();}
    catch(e){}
    
    try{ HasSendFax();}
    catch(e){}			    
    
    try{ ShowPromotionFields();}
    catch(e){}
    
	try
	{
	    document.getElementById("tc_cp").style.verticalAlign = "TOP";
		fnOnLoad();
	}
	catch(e){}
}
function timeover() { 
//событие, которое происходит по истечении отведенного вами срока
}
