
function preload(imgObj,imgSrc) {
	if (document.images) {
		eval(imgObj+' = new Image()');
		eval(imgObj+'.src = "'+imgSrc+'"');
	}
}

function changeImages() {
  if (document.images) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
	  document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + ".src");
    }
  }
}

document.addEvent = function(object, eventType,fn, useCapture) {
	if (object.addEventListener) {
		object.addEventListener(eventType, fn, useCapture);
		return true;
	} else {
		if (object.attachEvent) {
			var r = object.attachEvent("on"+eventType, fn);
			return r;
		}
	}
};

function imageWindow(imageName,imageWidth,imageHeight,alt) {
	var scroll = '';
	var winHeight = imageHeight;
	var winWidth = imageWidth;
	if ( winHeight > 700 ) {
		scroll = ",scrollbars=yes";
		winWidth += 20;
		winHeight = 700;
	}
   	var left = Math.floor( (screen.width - winWidth) / 2);
    var top = Math.floor( (screen.height - winHeight) / 2);
	newWindow = window.open("","newWindow","resizable=1,width="+winWidth+",height="+winHeight+",left="+left+",top="+top+scroll);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">'); 
	newWindow.document.write('<img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="'+alt+'">'); 
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
	return false;
}


function optinWindow(url){
	var w = 600; 
	var h = 550;
	var iLeft = (screen.width  - w) / 2;
	var iTop  = (screen.height - h) / 2;
	var iCp = window.open(url,"OptinWindow","width="+w+",height="+h+",scrollbars=yes,left="+iLeft+",top="+iTop);
	iCp.focus();
}