$(document).ready(function() {

	list_height = $('.language_list').height();
	list_width = $('.language_list').width();
	option_width = $('.selected_option').width();

	result_width = option_width > list_width ? option_width : list_width;
	///alert("option - "+option_width+"\n list - "+list_width+"\n resutl - "+result_width);
	result_width = 95;
	if ($.browser.msie && $.browser.version == '6.0') {
		$('.list_end_middle').css('bottom', '-8px');
		$('.list_border_right').css('right', '-3px');
		$('.list_end_right').css('right', '-3px');
		$('.list_end_left').css('left', '-11px');
		$('.list_end_left').css('bottom', '-8px');
	 }

	$('.selected_option .content').css('display', 'block');
	$('.selected_option .content').css('height', '23px');
	$('.selected_option').width(result_width+'px');

	$('.list_border_left').height(list_height+ 9 + 'px');
	$('.list_border_right').height(list_height+ 9 + 'px');
	$('.list_end_middle').width(result_width + 'px');
	$('.options').width(result_width + 'px');


	$('.selected_option').click(function()  {
		$('.language_list').css('display','block');
	});

	$('.language_list').mouseover(function()  {

		$('.language_list').css('display','block');

	});

	$('.language_list').mouseout(function()  {

		$('.language_list').css('display','none');

	});

	$('.link_to').mouseover(function() {

		$('img',$(this)).attr('src','/images/button_act.gif');

	});

	$('.link_to').mouseout(function() {
		$('img',$(this)).attr('src','/images/button.gif');
	});




} );

function mySwap($id1, $id2) {
	var $t1	= document.getElementById($id1).cloneNode(true);
	var $t2	= document.getElementById($id2).cloneNode(true);
	var $p1 = document.getElementById($id1).parentNode;
	var $p2 = document.getElementById($id2).parentNode;

	$p1.replaceChild($t2, document.getElementById($id1));
	$p2.replaceChild($t1, document.getElementById($id2));
}

function advOpen(openUrl, openWidth, openHeight, openSwitch) {
	var srw = screen ? (screen.width-50)    : 750;
    var srh = screen ? (screen.height-36)   : 564;
    var openScroll  	= "0";
	var documentWrite	= "";
	var	openParameters	= "";
    if ((openWidth>srw) || (openHeight>srh)) {
        openScroll  = "1";
        if (openHeight>srh) { openWidth  = openWidth+16; openHeight = srh-50; }
        if (openWidth>srw)  { openHeight = openHeight+16; openWidth = srw-50; }
    }

    srw     = (srw - openWidth)/2;
    srh     = (srh - openHeight)/5;

  	var UTCstring;
  	Today = new Date();
  	UTCstring = Today.getUTCHours()+Today.getUTCMinutes()+Today.getUTCSeconds()+Today.getTime();

	var openName;
	openName        = "openPopup"+UTCstring;

    openParameters  = "left="+srw+",top="+srh+",outerHeight=0,innerWidth,width="+openWidth+",innerHeight,height="+openHeight+",scrollbars="+openScroll+",titlebar=1,resizable=0";
    switch(openSwitch) {
        case "print":   openParameters  = "left="+srw+",top="+srh+",outerHeight=0,innerWidth,width="+openWidth+",innerHeight,height="+openHeight+",scrollbars=1,titlebar=1,resizable=0,menubar=1"; break;
        case "scroll":  openParameters  = "left="+srw+",top="+srh+",outerHeight=0,innerWidth,width="+openWidth+",innerHeight,height="+openHeight+",scrollbars=1,titlebar=1,resizable=0"; break;
    }
    var openPopup   = open(openUrl, openName, openParameters);
    return false;
}

function init() {
	if (window.initForm) { initForm(); }
}
