/*		year object -- start	*/

var v_today = new Date();
var v_Year = takeYear(v_today);
var v_Month = v_today.getMonth()+1;
var v_Day = 10;


function takeYear(theDate)
{
	x = theDate.getYear();
	var y = x % 100;
	y += (y < 38) ? 2000 : 1900;
	return y;
}

function leadingZero(nr)
{
	if (nr < 10) nr = "0" + nr;
	return nr;
}



if (v_Month > 9) {
v_Month = "09";
} else if (v_Month > 6) {
v_Month = "06";
} else if (v_Month > 3) {
v_Month = "03";
} else if (v_Month > 0) {
v_Month = "01";
}



function createDate()
{
	document.write(v_Day + "-" + v_Month + "-" + v_Year);
	}

/*		year object -- end		*/

var high_res = check_high_res();

function check_high_res ()
	{
		if(screen.width >= 1600)
			return true;
		else 
			return false;
	}

function include_css(low_res_css,high_res_css)
	{
	if (high_res)
		{
		document.write("<link rel=\"stylesheet\" href=\""+high_res_css+"\" type=\"text/css\" />");
		}
	else 
		{
		document.write("<link rel=\"stylesheet\" href=\""+low_res_css+"\" type=\"text/css\" />");
		}
	}


var top_menu_images;
var top_menu_images_path = "/common/images/top_menu/";

var icon_images;
var icons_images_path = "/common/images/";



function preload_images(images_names,images_array)
{
	images_array = new Array(images_names.length);
	for (var i = 0;i < images_names.length; i++)
		{	
		images_array[i] = new Image();
		images_array[i].src = images_names[i];		
		}

}


function preload_over_images(path,names,images_array)
{
	images_array = new Array(names.length*2);
	for (var i = 0;i < names.length; i++)
		{	
		images_array[i*2] = new Image();
		images_array[i*2].src = path+names[i]+".gif";
		
		images_array[i*2 + 1] = new Image();	
		images_array[i*2 + 1].src = path+names[i]+"_over.gif";	
		}
}



function switch_img(link)
	{
	
	for (var i =0; i < link.childNodes.length; i++)
		{
		if (link.childNodes[i].tagName == "IMG")
			break;
		}
	var img = null;
	if (i < link.childNodes.length)	
		img = link.childNodes[i];
	
	var t = "";
	if (img.src.indexOf("_over.gif") > 0)
		{
		img.src = img.src.replace("_over.gif",".gif");
		}
	else 
		{
		img.src = img.src.replace(".gif","_over.gif");	
		}
	return;
	}

function switch_suite_icon (img_id)
	{
	
	var img = document.getElementById(img_id);
	var img_src = img.src;
	
	if (img_src.indexOf("_over.gif") > 0)
		{
		img.src = img_src.replace("_over.gif",".gif");
		}
	else 
		{
		img.src = img_src.replace(".gif","_over.gif");	
		}
	return;
	}



/* 	measure the scroll width and position the page in the middle of the
	browser window								*/
	


function center_main_container()
{
return;
var scrl_width = getScrollerWidth();
var pc = document.getElementById("main_container");
var justifier = document.getElementById("justifier"); 

pc.style.left = ((justifier.offsetWidth + scrl_width - pc.offsetWidth) /2) +"px";

}



function getScrollerWidth()
{
    var scr = null;
    var inn = null;
    var wNoScroll = 0;
    var wScroll = 0;

    // Outer scrolling div
    scr = document.createElement('div');
    scr.style.position = 'absolute';
    scr.style.top = '-1000px';
    scr.style.left = '-1000px';
    scr.style.width = '100px';
    scr.style.height = '50px';
    // Start with no scrollbar
    scr.style.overflow = 'hidden';

    // Inner content div
    inn = document.createElement('div');
    inn.style.width = '100%';
    inn.style.height = '200px';

    // Put the inner div in the scrolling div
    scr.appendChild(inn);
    // Append the scrolling div to the doc
    document.body.appendChild(scr);

    // Width of the inner div sans scrollbar
    wNoScroll = inn.offsetWidth;
    // Add the scrollbar
    scr.style.overflow = 'auto';
    // Width of the inner div width scrollbar
    wScroll = inn.offsetWidth;

    // Remove the scrolling div from the doc
    document.body.removeChild(
        document.body.lastChild);

    // Pixel width of the scroller
    return (wNoScroll - wScroll);
}


function createBulletList(bl_id,bl_class,lines)
	{
	var html_code = "<div id='"+bl_id+"' class='"+bl_class+"'>\n";
	for (var i = 0; i < lines.length;i++)
		{
		html_code += "<div class='bl_entry'><div class='bl_dash'>-</div><div class='bl_content'>"+lines[i]+"</div></div>\n";
		}	
	html_code += "</div>\n";
	document.write(html_code);
	}

var popupWin;

function popup(o, w, h)
{
	var str = "toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=0";
	str += ",height=" + h;
	str += ",width=" + w;
	str += ",left=" + (screen.width - w)/2;
	str += ",top=" + (screen.height - h)/2;
	popupWin = window.open(o.href,"popupWin",str);
	popupWin.focus();
	return false;
}



function getWindowDimensions()
{


	var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }
  return {height: myHeight, width: myWidth};

}

function over_handler(link)
	{
	for (var i =0; i < link.childNodes.length; i++)
		{
		if (link.childNodes[i].tagName == "IMG")
			break;
		}
	var img = null;
	if (i < link.childNodes.length)	
		img = link.childNodes[i];
	
	var t = "";
	if (img.src.indexOf("_over.gif") < 0)
		{
		switch_img(link);
		}
	return false;
	}
	
function out_handler(link)
	{
	for (var i =0; i < link.childNodes.length; i++)
		{
		if (link.childNodes[i].tagName == "IMG")
			break;
		}
	var img = null;
	if (i < link.childNodes.length)	
		img = link.childNodes[i];
	
	var t = "";
	if (img.src.indexOf("_over.gif") > 0)
		{
		switch_img(link);
		}
	return false;
	}
	
	
	
	
////////////////////////////////////////////////////////////////////////////////////////////////

function recenterPage()
{
	var BW = getBrowserWidth();
	
	if(BW < 980)
	{
		document.getElementById("main_container").style.left 			= "0px";
		document.getElementById("main_container").style.visibility 		= "visible";
	}
	else
	{
		document.getElementById("main_container").style.left 			= ((getBrowserWidth() - 980) / 2) + "px";
		document.getElementById("main_container").style.visibility 		= "visible";
	}
}

function getBrowserWidth()
{

  var myWidth = 0;
  
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
  }
   
  return myWidth;
  
}