﻿
$(document).ready(function() {
	$("div.BoxHeaderStyle").corner("round 8px").parent().css('padding', '2px').corner("round 10px");
});

$(document).ready(function() {
	$("div.BoxGoldStyle").corner("round 8px").parent().css('padding', '2px').corner("round 10px");
});

$(document).ready(function() {
	$("div.BoxSilverStyle").corner("round 8px").parent().css('padding', '2px').corner("round 10px");
});

$(document).ready(function() {
	$("div.BoxBronzeStyle").corner("round 8px").parent().css('padding', '2px').corner("round 10px");
});

$(document).ready(function() {
	$("div.BoxPlatinumStyle").corner("round 8px").parent().css('padding', '2px').corner("round 10px");
});

$(document).ready(function() {
	$("div.BoxDiamondStyle").corner("round 8px").parent().css('padding', '2px').corner("round 10px");
});

$(document).ready(function() {
	$("div.BoxISVStyle").corner("round 8px").parent().css('padding', '2px').corner("round 10px");
});

$(document).ready(function() {
$("div.BoxGrayRounded").corner("round 8px").parent().css('padding', '2px').corner("round 10px");
});

// utility to provide some kind of verticalAlign
(function($) {
	$.fn.vAlign = function() {
		return this.each(function(i) {
			var ah = $(this).height();
			var ph = $(this).parent().height();
			var mh = (ph - ah) / 2;
			$(this).css('margin-top', mh);
		});
	};
})(jQuery);

(function ($) {
	$.fn.contentAlign = function (imageHeight, imageWidth) {
		return this.each(function (i) {
			var image = $(this).find("img");
			var hh = image.attr("h");
			var ww = image.attr("w");
			var mh = (imageHeight - hh) / 2;
			var mw = (imageWidth - ww) / 2;
			$(this).find("img").css('margin-top', mh);
			$(this).find("img").css('margin-left', mw);
		});
	};
})(jQuery);

function toTop(layer, action, z, usrName)
{
	var lref;
	if(document.getElementById && (lRef=document.getElementById(layer)))
	{
		lRef.style.visibility = action ? "visible" : "hidden";
		lRef.style.zIndex= z;

		if (lRef.style.visibility == "hidden")
			return;

		var txtObj = document.getElementById(usrName);
		txtObj.focus();
	}
}

function changeActionCountry(country, appPath)
{
	var act = document.forms[0].action;
	var re = new RegExp('\\b' + appPath + '\\b[\\/]\\w{3}[\\/]');
	var newAct = act.replace(re, appPath + '/' + country + '/');
	document.forms[0].action = newAct;
}
/*
function switchActionCountry(newAct)
{
	document.forms[0].action = newAct;
}
*/

function doSearch(searchPage, lang)
{
	var txtSearch = document.getElementById('txtSearch');
	var strSearch = txtSearch.value; // x-browser compatible
	window.location.href = searchPage + '?q=' + strSearch + '&cx=002618154740868493230:_ysyldc6xso&cof=FORID:9&hl=' + lang;
}

/* ------------- all the window.open functions are now collected here --------- */
function popupWindowWithTitle(url, title, width, height)
{
	var hWnd = window.open(url, title, "width=" + width + ", height=" + height + ", scrollbars=yes, resizable=no");
	if (!hWnd.opener) hWnd.opener = self;
	if (hWnd.focus != null) hWnd.focus();
}
function popupWindow(url, width, height)
{
	popupWindowWithTitle(url, "", width, height);
}
function NewWindow(url, width, height)
{
	popupWindow(url, width, height);
}
function NewWin(url, larghezza, altezza)
{
    var hWnd = window.open(url, "", "width=" + larghezza + ", height=" + altezza + " scrollbars=no, resizable=no, left=10, menubar=no,status=no,location=0, toolbar=no");
    if (!hWnd.opener) hWnd.opener = self;
    if (hWnd.focus != null) hWnd.focus();
}


/***********************************************
* Bookmark site script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
/* Modified to support Opera */
function bookmarksite(title, url)
{
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print)
	{ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	}
	else if(document.all)// ie
		window.external.AddFavorite(url, title);
}


/* Used by imagegallery rollover */
/* It's not multi-instance, we'll replace it with jQuery based version */
var j = 0;
var tabs;
function startIt(cntID, secs)
{
	var cnt = document.getElementById(cntID);
	tabs = cnt.getElementsByTagName('td');
	var tim = setInterval('doIt()', secs);
}

function doIt()
{
	for (var i = 0; i < tabs.length; ++i)
	{
		var tab = tabs[i];
		if (i == j)
			tab.style.display = 'block';
		else
			tab.style.display = 'none';
	}
	
	++j;
	if (j == tabs.length)
		j = 0;
}
/* end of code used by imagegallery rollover */



function printPage()
{
	try
	{
		var w = this.window;
		if (w.document)
		{
			w.focus();
			w.print();
		}
	}
	catch (e)
	{
		alert(e.description);
	}
}

