var uploader = function(hiddenFiledId, hiddenFiledThubnailId, informationLable) {
    this.hiddenFiledId = hiddenFiledId;
    this.hiddenFiledThubnailId = hiddenFiledThubnailId;
    this.informationLable = informationLable;
};

uploader.prototype = {
    uploadHandler: null,
    hiddenFiledId: null,
    hiddenFiledThubnailId: null,
    informationLable: null,
    
    onUploadComplete: function (uploadedPicture, thumbnail, informationLable){
        window.status = uploadedPicture;
        var hiddenElement = document.getElementById(this.hiddenFiledId);
        hiddenElement.value = uploadedPicture;
        var uploadedPictureThambnail = document.getElementById(this.hiddenFiledThubnailId);
        uploadedPictureThambnail.value = thumbnail;
        var label = document.getElementById(this.informationLable);
        label.innerText = uploadedPicture;
        if(this.uploadHandler!=null)
            this.uploadHandler(uploadedPicture, thumbnail);
    }
};

var windowHelper = {
    openPopup : function(url, width, height){
        var params = "height=" +  height + ", width=" + width + ",status=no,toolbar=no,menubar=no,location=no";
        window.open(url, null, params);
    }
};

var messageHelper = {
    hide : function(ids, recordID){
        for(var i = 0; i < ids.length; i++){
            $("message_" + ids[i]).style.display = "none";
        }
        $("hide" + recordID).style.display = "none";
        $("show" + recordID).style.display = "inline";
    },
    
    show : function(ids, recordID){
        for(var i = 0; i < ids.length; i++){
            $("message_" + ids[i]).style.display = "inline";
        }
        $("hide" + recordID).style.display = "inline";
        $("show" + recordID).style.display = "none";
    }
};

var photoAlbumHelper = {
    shonewPicture: function(divTitleID, imageID, title, imageURL){
        var idimageNew = imgCache.register(imageURL, imageID);
        var divTitle = $(divTitleID);
        if(typeof(divTitle)!='undefined'){
            divTitle.style.display = "inline";
            divTitle.innerText = title;
        }
        window.setTimeout("photoAlbumHelper._showPic('" + imageID + "','" + imageURL + "')", 1000);
    },
    
    _showPic: function(imageID, imageURL){
        var imageBig = $(imageID);
        imageBig.src = imageURL;
        imageBig.show();
        
    }
};

var imgCache = {
	register: function(URL, id) {
		var img = new Image();
		img.src = URL;
		if (!id)
			id = img.src;
		this[id] = img;
		return id;
	}
};

function moveTo(containerId, scrollValue, ids, currentId)
{
    var container = $(containerId);
    container.scrollTop = scrollValue;
    for(var i=0; i<ids.length; i++) {
        $(ids[i]).className = "unSelectedPagerItem";
    }
    $(currentId).className = "selectedPagerItem";
};

function selectImage(title, imageurl){
    $("titleContainer").update(title);
    $("imageContainer").src=imageurl;
   };

   function openGallery() {
   	window.open('/Pages/Gallery.aspx', "_gallery", 'width=780px, height=490px, scrollbars=no, toolbar=no, status=no, resizable=no');
   	return false;
   };


