function loadGalleryView() { 
 	 dojo.byId("ContentAccount").innerHTML = "<p class='loading-account' align='center'><img src='http://www.counto.com/templates/bevolution.net/images/loading-data-account.gif'/></p>"; // 
     dojo.byId("SwfPreviewloading").innerHTML="";
     dojo.byId("SwfPreview").innerHTML="";
 	 dojo.byId("editcd").innerHTML="";
 	 
 	 dojo.xhrGet( { 
        url: "incajax/accountreadgallerie.php?view=start", 
        handleAs: "text",
        timeout: 5000, // Time in milliseconds
        // The LOAD function will be called on a successful response.
        load: function(response, ioArgs) { //
            dojo.byId("ContentAccount").innerHTML = response; // 
             var quant=document.getElementById("galleryquantity").innerHTML;
             if(quant>0){
             //newLightbox();
            
             }
            return response; // 
        },
        // The ERROR function will be called in an error case.
        error: function(response, ioArgs) { // 
          console.error("HTTP status code: ", ioArgs.xhr.status); // 
           return response; // 
          }
        });
}



function newLightbox() {
	
	  /*
	  function string_to_date (args) {
        args = dojo.string.trim(args);
        arr = args.split('-');
        return new Date (parseInt(arr[0]), parseInt(arr[1], 10) - 1, parseInt(arr[2].substr(0,2), 10));
        }
		         var div = document.getElementsByName('birth_date')[0];
		         var val = ''
		         var w = new dijit.form.DateTextBox ({
		                name: div.name,
		                value: val
		         }, div);
   
	  
		  
         var dialog = new dojox.image.LightboxDialog({});
		 dialog.startup();
		 	dojo.connect(dojo.byId("tablegalerie"), "onclick", function(e){
			   e.preventDefault();
			   var link = dojo.attr(e.target,"href") || dojo.attr(e.target,"src");
    		   if(link){
			     // dialog.addImage({href:link,title:dojo.attr(e.target,"title")},dojo.attr(e.target,"group"));	
			      dialog.show({ href: link, title: dojo.attr(e.target,"title")});
			   }
		}); 
		 */

}

function viewMoreSettingsGallerie() {
	if(dojo.byId("more-settings-gallery").style.display=="block"){ 
       dojo.byId("more-settings-gallery").style.display="none";
   	}else dojo.byId("more-settings-gallery").style.display="block";
}


function gal_update_nameForm() {
	 dojo.byId('editgallerynameBtn').style.display="none"; 
	 dojo.byId('editgallerynameLoader').style.display="block"; 

        dojo.xhrPost ({
                url: 'incajax/accountreadgallerie.php',
                form: 'gal_update_name',
                load: function (data) {
                        dojo.byId('editgallerynameBtn').style.display="block"; 
                        dojo.byId('editgallerynameLoader').style.display="none";
                },
                error: function (error) {
                        console.error ('Error: ', error);
                        dojo.byId('editgallerynameLoader').style.display="none";
                }
    });
}

function gal_update_SliderForm() {
	 dojo.byId('editgallerysliderBtn').style.display="none"; 
	 dojo.byId('editgallerysliderLoader').style.display="block"; 

        dojo.xhrPost ({
                url: 'incajax/accountreadgallerie.php',
                form: 'gal_update_slider',
                load: function (data) {
                        dojo.byId('editgallerysliderBtn').style.display="block"; 
                        dojo.byId('editgallerysliderLoader').style.display="none";
                },
                error: function (error) {
                        console.error ('Error: ', error);
                        dojo.byId('editgallerysliderLoader').style.display="none";
                }
    });
}

function changeGalleryForm() {
	 dojo.byId('Select_gallery').style.display="none"; 
	 dojo.byId('Select_galleryLoader').style.display="block"; 
        dojo.xhrPost ({
                url: 'incajax/accountreadgallerie.php',
                form: 'changegalleryselect',
                load: function (data) {

                	   
                       dojo.byId('ContentAccount').innerHTML = data;
                       dojo.byId('Select_gallery').style.display="block"; 
                       dojo.byId('Select_galleryLoader').style.display="none";
                       
                         var quant=document.getElementById("galleryquantity").innerHTML;
			             if(quant>0){
			               //newLightbox();
			             }
                },
                error: function (error) {
						console.error ('Error: ', error);
                }
    });
}


function updateGalleryForm(file, id) {
	dojo.byId("uploadedFiles").innerHTML = "<p class='loading-account' align='center'><img src='http://www.counto.com/templates/bevolution.net/images/loading-data-account.gif'/></p>"; // 
	  dojo.xhrGet( { 
        url: "incajax/accountreadgallerie.php?modus=picturesave&picture="+file +"&galerieid="+id, 
        handleAs: "text",
        timeout: 5000, // Time in milliseconds
        // The LOAD function will be called on a successful response.
        load: function(response, ioArgs) { //
	        
    	    var quant=document.getElementById("galleryquantity").innerHTML;
    	    var newquant=parseInt(quant)+1;
    	    dojo.byId('galleryquantity').innerHTML = newquant;
            dojo.byId("uploadedFiles").innerHTML = response; // 
            
            var quant=document.getElementById("galleryquantity").innerHTML;
             if(quant>0){
               // newLightbox();
             }
            return response; // 
        },

        error: function(response, ioArgs) { // 
          console.error("HTTP status code: ", ioArgs.xhr.status); // 
           return response; // 
          }
        });
}


function delPicture(message,safepic,galerieid,picture) {

	if(confirm(message)){
	  
	  dojo.byId("uploadedFiles").innerHTML = "<p class='loading-account' align='center'><img src='http://www.counto.com/templates/bevolution.net/images/loading-data-account.gif'/></p>"; // 

	  dojo.xhrGet( { 
        url: "incajax/accountreadgallerie.php?modus=deletePicture&safepic="+safepic +"&galerieid="+galerieid+"&picture="+picture, 
        handleAs: "text",
        timeout: 5000, // Time in milliseconds
        // The LOAD function will be called on a successful response.
        load: function(response, ioArgs) { //
	        
    	    var quant=parseInt(document.getElementById("galleryquantity").innerHTML);
    	    var newquant=(quant-1);
    	    dojo.byId('galleryquantity').innerHTML = newquant;
            dojo.byId("uploadedFiles").innerHTML = response; // 
            if(newquant>0){
            // newLightbox();
            }
            return response; // 
        },

        error: function(response, ioArgs) { // 
          console.error("HTTP status code: ", ioArgs.xhr.status); // 
           return response; // 
          }
        });
     }	
}

function newGalleryInsert() { 
    dojo.byId("loadingcontainer").style.display="block";
	dojo.byId("ContentAccountGallery").style.display="none";
	 
    dojo.xhrPost ({
                url: 'incajax/accountreadgallerie.php',
                form: 'SetNewGalleryForm',
                load: function (data) {
                	
                	dojo.byId('ContentAccount').innerHTML = data;

                },
                error: function (error) {
						console.error ('Error: ', error);
                }
    });
   

}

function deleteGallery(message) {
	dojo.byId("loadingcontainer").style.display="block";
	dojo.byId("ContentAccountGallery").style.display="none";
	if(confirm(message)){
		
		   	dojo.byId("loadingcontainer").style.display="block";
	        dojo.byId("ContentAccountGallery").style.display="none";
	        
	        
		    var kw =({
	                url: 'incajax/accountreadgallerie.php',
	                form: 'delGalleryForm',
	                load: function (data) {
	                	 dojo.byId("ContentAccount").innerHTML = data; // 
	                   	 var quant=document.getElementById("galleryquantity").innerHTML;
			             if(quant>0){
			             //newLightbox();
			             }
			            return data; //
	                },
	                error: function (error) {
							console.error ('Error: ', error);
	                }
	    });
	    
	    
	    dojo.xhrPost(kw);
	}
	

}

//slideshow colour
function ColorSlideshow(col,who){
	 var color=col;
	 var whichid=who;
	 document.getElementById(whichid).value = color;
	 previewSlider();
}

//settings for pictureslideshow 
function previewSlider(){
	
	
	
	var flashslidernavi;
	var flashslidernaviEmbed;
	           for(var i=0;i<2;i++) {
					if(document.gal_update_slider.flashslidernavi[i].checked == true) 
					{
						flashslidernavi=document.gal_update_slider.flashslidernavi[i].value;
					}
				}
    if(flashslidernavi=="Y"){
    	flashslidernaviEmbed="true";
    }else flashslidernaviEmbed="false";
				
	var transitiontime;
	
	           for(i=0;i<document.gal_update_slider.transitiontime.length;i++){
			    	
			    	
			       if(document.gal_update_slider.transitiontime.options[i].selected == true){
			       	  transitiontime=document.gal_update_slider.transitiontime.options[i].value;
			       }
			    }
			    
			    
	var	transitioneffect;
	
	          for(i=0;i<document.gal_update_slider.transitioneffect.length;i++){
			    	
			    	
			       if(document.gal_update_slider.transitioneffect.options[i].selected == true){
			       	  transitioneffect=document.gal_update_slider.transitioneffect.options[i].value;
			       }
			    }
			    
	var	backcolor 	= 	document.getElementById("backcolor").value;
	var	frontcolor	=	document.getElementById("frontcolor").value;
	var	lightcolor	=	document.getElementById("lightcolor").value;
	
	var	id			=	document.getElementById("galerieidwer").value;
	var	gal			=	document.getElementById("galerieid").value;
	
	var file="http://www.counto.com/imageslider.php?filename="+id+"_"+gal
	var s2 = new SWFObject("http://counto.com/slider.swf","slider",310,233,7);
			
	s2.addParam("wmode", "transparent");
	s2.addParam("salign", "tl");
    s2.addVariable("file",file);
    s2.addVariable("shownavigation",flashslidernaviEmbed);
    s2.addVariable("transition",transitioneffect);
    s2.addVariable("rotatetime",transitiontime);
    s2.addVariable("shuffle","false");
    s2.addVariable("autostart","true");
    s2.addVariable("backcolor",backcolor);
    s2.addVariable("frontcolor",frontcolor);
    s2.addVariable("lightcolor",lightcolor);    
	s2.write("sliderpreviewgallery");
		      
}

//showthumbnails details
function viewThumbDetails(detail,form){
	 document.getElementById(form).style.display="none";
	 document.getElementById(detail).style.display="block";
}

//hide thumbnails details
function hideThumbDetails(detail,form){
	 document.getElementById(detail).style.display="none";
	 document.getElementById(form).style.display="block";
}
