//==================================
// Date and Time
//==================================
function currentYear(){
var dt = new Date();
var y  = dt.getYear();
if (y < 1000) y +=1900;
return y;
}

//==================================
// Popups
//==================================
function popCVV(href) {
	openCenterWindow(href,'CVV','330','260');
}

// ============================================================================
// Window Helpers
// ============================================================================

function openWindow(url,name,width,height,chrome,scroll,xpos,ypos){
	var features = "";
	chrome = chrome ? "yes" : "no";
	scroll = scroll ? "yes" : "no";
	features += "toolbar="+chrome+",status=no,menubar=no,location=no";
	features += ",scrollbars="+scroll+",resizable="+scroll;
	if(width) features += ",width="+width;
	if(height) features += ",height="+height;
	if(xpos) features += ",screenX="+xpos+",left="+xpos;
	if(ypos) features += ",screenY="+ypos+",top="+ypos;
	openWindowReference = window.open(url,name,features);
	if(openWindowReference != null && !openWindowReference.closed){
		openWindowReference.focus();
	}
}
function openCenterWindow(url,name,width,height,chrome,scroll){
	var xpos = window.screen.availWidth ? Math.round((window.screen.availWidth-parseInt(width))/2) : null;
	var ypos = window.screen.availHeight ? Math.round((window.screen.availHeight-parseInt(height))/2) : null;
	openWindow(url,name,width,height,chrome,scroll,xpos,ypos);
}
function openCenter(url,name,width,height){
	openCenterWindow(url,name,width,height,false,false);
}
function openCenterChrome(url,name,width,height){
	openCenterWindow(url,name,width,height,true,false);
}
function openCenterScroll(url,name,width,height){
	openCenterWindow(url,name,width,height,false,true);
}
function openCenterChromeScroll(url,name,width,height){
	openCenterWindow(url,name,width,height,true,true);
}

// --------------------------------------------------

// Open a link in a new window. Uses target property to 
// be most compatible - window.open opens strange windows in some browsers
// NOTE: pass (this) as the argument instead of this.href
function openNewWindow(link) {
	link.target = '_blank';
}

// Open a link in the window.opener, and optionally close the current window
function targetWindowOpener(href, closeWindow) {
	// set closeWindow = true to close the current window
	if (closeWindow != false) window.close();
	window.opener.location = href;
}

// --------------------------------------------------

function getWindowWidth(){
	if(document.all) return (document.getElementById && document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth;
	else return window.innerWidth;
}

