activ = null;
activ_background = null;

backgrounds = new Array();
backgrounds['about'] = new Array();
backgrounds['about']['closed'] = new Image();
backgrounds['about']['closed'].src = '/static_media/css_lib/images/content/li-closed.gif';
backgrounds['about']['open'] = new Image();
backgrounds['about']['open'].src = '/static_media/css_lib/images/content/li-open.gif';
backgrounds['press'] = new Array();
backgrounds['press']['closed'] = new Image();
backgrounds['press']['closed'].src = '/static_media/css_lib/images/content/press/expand.gif';
backgrounds['press']['open'] = new Image();
backgrounds['press']['open'].src = '/static_media/css_lib/images/content/press/collapse.gif';
backgrounds['products'] = new Array();
backgrounds['products']['closed'] = new Image();
backgrounds['products']['closed'].src = '/static_media/css_lib/images/content/products_details/tabs_content_closed.gif';
backgrounds['products']['open'] = new Image();
backgrounds['products']['open'].src = '/static_media/css_lib/images/content/products_details/tabs_content_open.gif';
backgrounds['sync'] = new Array();
backgrounds['sync']['closed'] = new Image();
backgrounds['sync']['closed'].src = '/static_media/css_lib/images/content/sync/expand.gif';
backgrounds['sync']['open'] = new Image();
backgrounds['sync']['open'].src = '/static_media/css_lib/images/content/sync/collapse.gif';
backgrounds['menu'] = new Array();
backgrounds['menu']['closed'] = new Image();
backgrounds['menu']['closed'].src = '/static_media/css_lib/images/content/press/expand.gif';
backgrounds['menu']['open'] = new Image();
backgrounds['menu']['open'].src = '/static_media/css_lib/images/content/press/collapse.gif';

/**
 * rt66_toggle
 */
function rt66_toggle(obj, curr_element, bg_sec, accordeon, horizontal)
{
	var el = getObj(obj);
	var background_el = getObj(curr_element);
	
	if (accordeon == 1)
	{ // accordeon style
		if (el.style.display != 'none') 
		{
			el.style.display = 'none';
			background_el.style.backgroundImage = 'url(' + backgrounds[bg_sec]['closed'].src + ')';
		}
		else 
		{
			el.style.display = '';
			background_el.style.backgroundImage = 'url(' + backgrounds[bg_sec]['open'].src + ')';		
		}
	}
	else
	{ // tabs style
		classes = new Array();
		
		if (horizontal)
		{ // horizontal sytle
			classes['active'] = 'tab_name_active';
			classes['inactive'] = 'tab_name';	
		}
		else
		{ // vertical style
			classes['active'] = 'product_active';
			classes['inactive'] = 'product_categories';	
		}
		if(activ_background)
		{
			activ_background.className = classes['inactive'];
		}
		
		if (activ)
		{
			activ.style.display = "none";
		}
		
		activ_background = background_el;
		activ = el;
		el.style.display = "block";
		background_el.className = classes['active']; 	
	}
}

/**
 * getObj
 * 
 * get the corresponding element
 */
function getObj(name)
{
	if (document.getElementById)
	{
		element = document.getElementById(name);
	}
	else if (document.all)
	{
		element = document.all[name];
	}
	else if (document.layers)
	{
		element = document.layers[name];
	}
	return element;
}

function openNewWindow(myURL) 
{        
	testwindow = window.open(myURL,'popup','height=600,width=800,status=0,menubar=0,scrollbars=0,toolbar=0,resizable=0,directories=0');
	testwindow.moveTo(100,100);
}

function toggle(obj) 
{
	var el = document.getElementById(obj);
	el.style.display = (el.style.display != 'none' ? 'none' : '' );
}

document.domain = "www.66.com";
//document.domain = "localhost";
//document.domain = "test.route66.ro";

function resizeIframeToFitContent(i) 
{
	try
    {
   		iframe = document.getElementById(i);
   		var innerDoc = (iframe.contentDocument) ? iframe.contentDocument : iframe.contentWindow.document;
      	if (innerDoc.body.offsetHeight) //ns6 syntax
      	{
      		iframe.height = innerDoc.body.offsetHeight;// + 32; //Extra height FireFox
      	}
      	else if (iframe.Document && iframe.Document.body.scrollHeight) //ie5+ syntax
      	{
         	iframe.height = iframe.Document.body.scrollHeight;
		}
    }
    catch(err)
    {
      alert(err.message);
    }		
}