//   Copyright(c) 2003-2007 New Media Guru Ltd
//   window.onerror = null;

var winFeatures="width=400,height=300,left=200,top=200,scrollbars=0";
//url[, Features]
function openWin(url)
{
	var newFeatures=(arguments[1])?arguments[1]:winFeatures;
	window.open(url,"win",newFeatures);
	return false;
}

//url ,width,height
function openCenterWin(url,width,height)
{
	var features	=(arguments[3])?arguments[3].split(","):winFeatures.split(",");
	var newFeatures	=new Array();
	var left, top;
		
	for (var i=0;i<features.length; i++)
	{
		switch(features[i].substr(0,3))
		{
			case 'wid':	case 'hei':						break;
			case 'lef':	left=features[i].split("=")[1];	break;
			case 'top':	top=features[i].split("=")[1];	break;
			default:	newFeatures.push(features[i]);	break;
		}
	}

	if(width&&height)
	{
		newFeatures.push('width='+width);
		newFeatures.push('height='+height);
		newFeatures.push('left='+((screen.width)?(screen.width-width)/2:200));
		newFeatures.push('top='+((screen.height)?(screen.height-height)/2:200));
	}
	return openWin(url,newFeatures.join(","));
}


//link[, width][, height][, title][, background]
function popup_image(link)
{

		var width		=(arguments[1])?arguments[1]:640;
		var height		=(arguments[2])?arguments[2]:480;
		var title		=(arguments[3])?arguments[3]:'&nbsp;';
		var background	=(arguments[4])?arguments[4]:'#D9EDF8';

		var newWindow=window.open("","image","width="+width+", height="+height+", scrollbars=0, left="+((screen.width)?(screen.width-width)/2:200)+",top="+((screen.height) ?(screen.height-height)/2:200)+",");

		newWindow.document.write('<html><title>'+title+'</title><body leftmargin="0" rightmargin="0" topmargin="0" marginwidth="0" marginheight="0" bgcolor="'+background+'" onLoad="this.focus();">');
		newWindow.document.write('<img src="'+link+'" onClick="window.close();" border="0" alt="'+title+'" title="'+title+'">');
		newWindow.document.write('</body></html>');
		newWindow.document.close();
		newWindow.focus();
		return false;
}

function closeWin() 
{
  if (win && win.open && !win.closed) win.close();//window.close();
}
