﻿

this.screenshotPreview = function() {
    /* CONFIG */

    xOffset = 10;
    yOffset = 30;

    // these 2 variable determine popup's distance from the cursor
    // you might want to adjust to get the right result

    /* END CONFIG */
    $("div.product-container-item0").hover(function(e) {

        //        this.t = this.title;
        //        this.title = "";
        var c = "";  //(this.t != "") ? "<br/>" + this.t : "";
        var imgsrc = ($(this).attr("imglnk") != "") ? $(this).attr("imglnk") : "";

        if (imgsrc == "") { return; }
        //alert(imgsrc);

        $("body").append("<p id='screenshot'><img src='" + imgsrc + "?mw=175&as=false' alt='' />" + c + "</p>");
        $("#screenshot")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function() {
	    //this.title = this.t;
	    $("#screenshot").remove();
	});

    $("div.product-container-item0").mousemove(function(e) {
        $("#screenshot")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px");
    });


    $("div.product-container-item1").hover(function(e) {

        //        this.t = this.title;
        //        this.title = "";
        var c = "";  //(this.t != "") ? "<br/>" + this.t : "";
        var imgsrc = ($(this).attr("imglnk") != "") ? $(this).attr("imglnk") : "";
        if (imgsrc == "") { return; }
        //alert(imgsrc);

        $("body").append("<p id='screenshot'><img src='" + imgsrc + "?mw=175&as=false' alt='' />" + c + "</p>");
        $("#screenshot")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function() {
	    //this.title = this.t;
	    $("#screenshot").remove();
	});

    $("div.product-container-item1").mousemove(function(e) {
        $("#screenshot")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px");
    });


};

/* Standard Javascripts */
/* Standard Javascripts */
/* Standard Javascripts */
function doClear(inputField) {
    if (inputField.value == inputField.defaultValue) {
        inputField.value = "";
        /*inputField.style.color = "black";*/
    }
}

// put all your jQuery goodness in here.
$(document).ready(function() {

    $("a[sharewith]").click(function(ev) {

        //alert("start sharewith");
        var rel = $(this).attr("sharewith");
        var url = encodeURIComponent(self.location.href);
        var title = encodeURIComponent($("title:first").html());
        rel = rel.replace("%url", url);
        rel = rel.replace("%title", title);
        self.location.href = rel;
        return false;
    });

    screenshotPreview();
    //$(".black_button").click(function(ev){PopupLink("","");return false});
    
    //$(".black_button").colorbox({iframe: false, innerWidth: 500, innerHeight: 600 });
    
    

    

});   // end ready function()






