
function init(title) {
    hideDiv('loader'); 
    startTyping(title, 'title');
    initDOMnews();
}



function swapImage(availabilityId, code, colorImage, productName, description, color, price) {

    //alert("ok")

    var text = "<p><span>Nome prodotto: </span>" + productName + "</p><p><span>Descrizione: </span>" + description + "</p><p><span>Colore: </span>" + color + "</p><p><span>Codice colore: </span>" + code + "</p><p><span>Prezzo: </span>" + price + "</p>"
	
	eval(code + ' = new Image()');
	eval(code + '.src = "images/colors/' + colorImage + '"');
	
	var tmpChar = color.substring(0,1).toUpperCase();
    var postString = color.substring(1,color.length);
    color = tmpChar + postString;

	eval('document.color.src = ' + code + '.src');
	eval('document.color.alt = "' + color + '"');
	
	document.getElementById("product").innerHTML = text;
	
	document.formMain.availabilityId.value = availabilityId;
	//document.formMain.product.value = productId;
	//document.formMain.category.value = categoryId;
	
	//document.forms.item(0).availability.value = availabilityId;

}


	function showDiv(elementName){
	eval("document.getElementById('" + elementName + "').style.display = 'block'");
}


	function hideDiv(elementName){
	eval("document.getElementById('" + elementName + "').style.display = 'none'");
}


var text="content of text here";
var delay=50;
var currentChar=1;
var destination="[not defined]";
var timer = 0;

function type() {
  	
	if (document.getElementById) {

    	var dest=document.getElementById(destination);
    
		if (dest) {

			dest.innerHTML=text.substr(0, currentChar);
    		currentChar++
	
			if (currentChar>text.length) {
        		currentChar=1;
        		clearTimeout(timer);
    		}
    		else {
        		timer = setTimeout("type()", delay);
   			}
		}
	}
}


function startTyping(textParam, destinationParam) {
	text = textParam	
	destination = destinationParam
	
	type();
}


var newWindow = 0;

function openNewWindow(url, height, width, menubar, scrollbar) {

	//if (!newWindow.closed && newWindow.location) {
		//newWindow.location.href = url;
	//}
	//else {
		newWindow = window.open(url, "newWindow", "width=" + width + ",height=" + height + ",menubar=" + menubar + ",resizable=no,scrollbars=" + scrollbar + ",toolbar=no,fullscreen=no");
		//if (!newWindow.opener) newWindow.opener = self;
	//}
	if (window.focus) {newWindow.focus()}
	//return false;
	
}

function gvRowClick(targ, arg)
{
    $get('__EVENTTARGET').value = targ;
    $get('__EVENTARGUMENT').value = arg;
    return true;
}

