jQuery.noConflict();

var help_infos = new Array();

jQuery(document).ready(function () {
	// banner();
	get_help();
	create_help();
	create_order_radios();
	create_mail_links();
});

var get_help = function()
{
        	jQuery('.ishelp').each(function () {
                	help_infos.push(jQuery(this).attr('title'));
                	jQuery(this).removeAttr('title');
        	});
}

var create_help = function ()
{
	var i = 0;
	jQuery('.ishelp').each(function () {
		var el = this;
		var offset = jQuery(el).offset();
		jQuery('body').append('<span class="helpbox" onmouseover="show_help(this)" onmouseout="hide_help(this)" style="left: ' + (offset.left + (jQuery(el).width() - 26)) + 'px; top: ' + (offset.top + 12) + 'px"><span class="t">' + help_infos[i] + '</span><span class="b"></span></span>');
			i++;
		jQuery(this).removeAttr('title');
	});
};

jQuery(window).resize(function(){
	move_help();
});

var move_help = function ()
{
    jQuery('.helpbox').remove();  
	create_help();
};

var create_order_radios = function ()
{
	jQuery('p.orde').find('input[type=radio]').click(function () {
		jQuery(this).parents('p.orde').find('label').removeClass('s');
		if (this.checked)
			jQuery(this).parents('label').addClass('s');
	});
};

var create_mail_links = function ()
{
	jQuery('a[href^=mailto]').each(function () { 
		this.href = this.href.replace('*usun.to*', '');
	});
};

var show_help = function (el)
{
       var offset = jQuery(el).offset();
       jQuery(el).css('opacity', 0).show().addClass('helpvisible').css('left', offset.left - 90).css('top', offset.top - (jQuery(el).height() - 26)).css('opacity', 1);
};

var hide_help = function (el)
{
	var offset = jQuery(el).offset();
	var height = jQuery(el).height();
	jQuery(el).removeClass('helpvisible').css('left', offset.left + 90).css('top', offset.top + (height - 26));
};

var banner = function ()
{
	jQuery('#topbannerbg').media({
		width: 600,
		height: 165,
		src: 'swf/_main.swf',
		params: {
			quality: 'high',
			menu: 'false',
			scale: 'noscale'
		},
		flashversion: '8'
	});
};
