/* 
 * html2canvas v0.25 <http://html2canvas.hertzen.com>
 * Copyright (c) 2011 Niklas von Hertzen. All rights reserved.
 * http://www.twitter.com/niklasvh 
 * 
 * Released under MIT License
 */

/*
 * The MIT License

 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:

 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.

 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */


/*
 * jQuery helper plugin for examples and tests
 */
			
(function( $ ){
    $.fn.html2canvas = function(options) {
      
        var object = $.extend({},{
            logging: false,
            proxyUrl: "http://html2canvas.appspot.com/", // running html2canvas-python proxy
            ready: function(renderer) {
            	//$("#canvas_slika").hide();
                $.post("http://www.designmadness.si/wp-content/themes/DesignMadnessBeta/upload.php", {slika:renderer.canvas.toDataURL()}, function(data) {
                	/*url = "http://www.designmadness.si/";
                	link = "http://www.facebook.com/dialog/feed?app_id=263255760368186&display=popup&to=designmadness.si&name=http://www.designmadness.si/&redirect_uri="+url+"facebook/?zapri=1&picture="+url+"wp-content/uploads/"+data;	
                	
   			        testwindow = window.open(link, "mywindow", "location=false,status=0,menubar=0,scrollbars=1,width=430,height=360");
   			        testwindow.moveTo(Math.round((screen.width-430)/2), Math.round((screen.height)/4));*/
   			        $.facebox.close();
                
                });
                //$(renderer.canvas).remove();
            }
            
        },options);
        
        $.facebox("Prosim počakajte trenutek, pripravljam sliko...");
        
        new html2canvas(this.get(0), object);
    };
})( jQuery );
	

