function windowOpenSmall(url){
	var winWidth = 800;
	var winHeight = 600;
	var posLeft = (screen.availWidth - winWidth) / 2;
	var posTop = (screen.availHeight - winHeight) / 2;
	var winInfo = 'width=' + winWidth + ',height=' + winHeight + ',left=' + posLeft + ',top=' + posTop + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no';
	var winlaunch = window.open(url, 'popupwindow', winInfo);
	winlaunch.moveTo(posLeft,posTop);
}

function windowOpenSmallScroll(url, winWidth, winHeight){
	//var winWidth = 600;
	//var winHeight = 250;
	var posLeft = (screen.availWidth - winWidth) / 2;
	var posTop = (screen.availHeight - winHeight) / 2;
	var winInfo = 'width=' + winWidth + ',height=' + winHeight + ',left=' + posLeft + ',top=' + posTop + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no';
	var winlaunch = window.open(url, 'popupwindow', winInfo);
      winlaunch.creator = self;
	winlaunch.moveTo(posLeft,posTop);
}

function windowOpenSmallScrollbis(url, winWidth, winHeight){
	//var winWidth = 600;
	//var winHeight = 250;
	var posLeft = 150;
	var posTop = 0;
	var winInfo = 'width=' + winWidth + ',height=' + winHeight + ',left=' + posLeft + ',top=' + posTop + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no';
	var winlaunch = window.open(url, 'popupwindow', winInfo);
      winlaunch.creator = self;
	winlaunch.moveTo(posLeft,posTop);
}

function windowOpenNoScroll(url, winWidth, winHeight){
	//var winWidth = 600;
	//var winHeight = 250;
	var posLeft = (screen.availWidth - winWidth) / 2;
	var posTop = (screen.availHeight - winHeight) / 2;
	var winInfo = 'width=' + winWidth + ',height=' + winHeight + ',left=' + posLeft + ',top=' + posTop + ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';
	var winlaunch = window.open(url, 'popupwindow', winInfo);
      winlaunch.creator = self;
	winlaunch.moveTo(posLeft,posTop);
}

function windowMaxSize(url){
	var winWidth = screen.availWidth
	var winHeight = screen.availHeight
	var winInfo = 'width=' + winWidth + ',height=' + winHeight + ',toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no';
	var winlaunch = window.open(url, 'popupwindow', winInfo);
	
}
function loginwindow(url){
	var winWidth = screen.availWidth
	var winHeight = screen.availHeight
	var winInfo = 'width=' + winWidth + ',height=' + winHeight + ',toolbar=yes,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no';
	var winlaunch = window.open(url, 'popupwindow', winInfo);
	
}
function openWin(theURL,winName,features) {
  	window.open(theURL,winName,features);
}
function intercetta() {
    for (var i=0; i<document.links.length; i++)
        if (document.links[i].className=="blank") {
            document.links[i].target="_blank";
        } 
}
window.onload = intercetta;
		
if (!applesearch)	var applesearch = {};

applesearch.init = function ()
{
	// add applesearch css for non-safari, dom-capable browsers
	if ( navigator.userAgent.toLowerCase().indexOf('safari') < 0  && document.getElementById )
	{
		this.clearBtn = false;
		
		// add style sheet if not safari
		var dummy = document.getElementById("dummy_css");
		if (dummy)	dummy.href = "applesearch.css";
	}
}

// called when on user input - toggles clear fld btn
applesearch.onChange = function (fldID, btnID)
{
	// check whether to show delete button
	var fld = document.getElementById( fldID );
	var btn = document.getElementById( btnID );
	if (fld.value.length > 0 && !this.clearBtn)
	{
		btn.style.background = "white url('../html/html_style/srch_r_f2.gif') no-repeat top left";
		btn.fldID = fldID; // btn remembers it's field
		btn.onclick = this.clearBtnClick;
		this.clearBtn = true;
	} else if (fld.value.length == 0 && this.clearBtn)
	{
		btn.style.background = "white url('../html/html_style/srch_r.gif') no-repeat top left";
		btn.onclick = null;
		this.clearBtn = false;
	}
}


// clears field
applesearch.clearFld = function (fldID,btnID)
{
	var fld = document.getElementById( fldID );
	fld.value = "";
	this.onChange(fldID,btnID);
}

// called by btn.onclick event handler - calls clearFld for this button
applesearch.clearBtnClick = function ()
{
	applesearch.clearFld(this.fldID, this.id);
}

/* END applesearch object */
