(function($) {

  jQuery.sitebuilder.downloadTemplate = { 
              };
              
    
     jQuery.sitebuilder.downloadTemplate.OpenFrm = function(obj)
     {
 
        jQuery.sitebuilder.Log.logMessage('obj=============='+obj, LOG_PRIORITY.DEBUG);
        jQuery("#"+jQuery(this).attr("selectPictureID")).attr('src');
        var  divDialog =  jQuery('#templatedetail-download');   
        var  TemplateItemId  =  jQuery(obj).attr("temItemID"); 
        divDialog.find('#template_item_id').val(TemplateItemId);
        jQuery("#divpictureName").get(0).innerHTML = ""; 
        divDialog.rvsDialog('open');
        var formParam = jQuery.sitebuilder.serialize.form('#frmDownloadTem');
              jQuery.sitebuilder.Ajax.connect(formParam, {
              
              waitDialog:function(event){
				divDialog.find('#downloadTem').LoadingDisplay(event);
			},
              
                callback: {
                    doSuccess: function(data) {
                    jQuery.sitebuilder.Log.logMessage('fn : OpenFrm doSuccess=============='+data, LOG_PRIORITY.DEBUG);
                    divfrm  =  divDialog.find('#divpictureName');
                    divfrm.convertHtmlToJs(data);
                    }                                                            
                }
            });     
     } ,
     
      jQuery.sitebuilder.downloadTemplate.chImage  = function(obj)
      {
               var  imgId = jQuery(obj).attr("imgId");
               var  imgUrl = jQuery(obj).attr("imgUrl");
               var  imgLink = jQuery(obj).attr("imgLink");
               jQuery("#templatedetail-download").find("#SelectPic").attr({src:imgUrl});
              
        	    if (jQuery("#templatedetail-download").find("#alink" + imgId).is(":visible"))
        	     {
			         jQuery("#templatedetail-download").find("#alink" + imgId).arrt({href:imgLink});
		        }	        
     }
            
 })(jQuery);
 