/**
 *
 * Base image class that provides the interface for loading and manipulating images.
 * <p>Usage: var imgManager = new bsfImageManager()
 */

function bsfImageManager() {
    this.init(); 
}


    /**
     * Provides a method for preloading document Images.
     * @method loadImages
     * @return {}
     */
    bsfImageManager.prototype.loadImages = function() {
		 var imageList = document.getElementsByTagName('img');
		 if (imageList){
			for (var i = 0; i < imageList.length; i++) {
				imageObj = new Image();
				imageObj.setAttribute('src',imageList[i].getAttribute('src'));
			}
		 }	 
    }


    /**
     * Provides a method for initializing image manager.
     * @method init
     * @return {}
     */
    bsfImageManager.prototype.init = function() {

    }

    /**
     * Provides a method for initializing image manager.
     * @method init
     * @return {}
     */
    bsfImageManager.prototype.loadRollovers = function() {
	  if (!document.getElementById) return
		var imgOriginSrc;
		var imgTemp = new Array();
	    var imgarr = document.getElementsByTagName('img');
		  for (var i = 0; i < imgarr.length; i++) {
			if (imgarr[i].getAttribute('hsrc')) {
				imgTemp[i] = new Image();
				imgTemp[i].src = imgarr[i].getAttribute('hsrc');
				imgarr[i].onmouseover = function() {
					imgOriginSrc = this.getAttribute('src');
								var imagetest=new Image()
								window.status=this.alt
								imagetest.src=this.getAttribute('hsrc')					
								if (imagetest.complete)
										 this.setAttribute('src',this.getAttribute('hsrc'))
										 this.style.cursor="pointer"
										
				}
				imgarr[i].onmouseout = function() {
								var imagetest=new Image()
								window.status=''
								imagetest.src=imgOriginSrc
								if (imagetest.complete)
									   this.setAttribute('src',imgOriginSrc)
									
				}
				if (imgarr[i].getAttribute('url')) {
				imgarr[i].onclick = function() {
					if (this.getAttribute('url') != ""){
					 window.location.href=this.getAttribute('url');
					}
				}        
			   }
			}
		  }
    }


