/*
 * Image preview script 
 * powered by jQuery (http://www.jquery.com)
 * 
 * written by Alen Grakalic (http://cssglobe.com)
 * 
 * for more info visit http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery
 *
 */



function jump() {

    if (document.filter.type.value == "select") {
        return;
    }
    
    if (document.filter.type.value == "all") {
        window.location = 'http://www.custom-usb-drive.com/promotional-products/business-gifts.html';
    }

    if (document.filter.type.value == "metal") {
        window.location = 'http://www.custom-usb-drive.com/promotional-products/metal-usb-drives.html';
    }

    if (document.filter.type.value == "plastic") {
        window.location = 'http://www.custom-usb-drive.com/promotional-products/plastic-usb-flash-drives.html';
    }

    if (document.filter.type.value == "plastic-metal") {
        window.location = 'http://www.custom-usb-drive.com/promotional-products/alu-optic-usb.html';
    }

    if (document.filter.type.value == "slim") {
        window.location = 'http://www.custom-usb-drive.com/promotional-products/slim-memory-drives.html';
    }
    
    if (document.filter.type.value == "usb-leather") {
        window.location = 'http://www.custom-usb-drive.com/promotional-products/usb-leather-cases.html';
    }
    
    if (document.filter.type.value == "eco-friendly") {
        window.location = 'http://www.custom-usb-drive.com/promotional-products/eco-friendly.html';
    }

}



function websitejump() {

    if (document.webjump.site.value == "select") {
        return;
    }
     if (document.webjump.site.value == "usa 1") {
        window.location = 'http://www.custom-usb-drive.com';
    }
    if (document.webjump.site.value == "uk") {
        window.location = 'http://www.amstore-memory.co.uk';
    }
    if (document.webjump.site.value == "nz") {
        window.location = 'http://www.amstore.co.nz';
    }
    if (document.webjump.site.value == "germany") {
        window.location = 'http://www.usbflashmemory.de';
    }
    if (document.webjump.site.value == "sa") {
        window.location = 'http://www.amstore.co.za';
    }
    if (document.webjump.site.value == "oz") {
        window.location = 'http://www.amstoregroup.com.au';
    }
    if (document.webjump.site.value == "am uk") {
        window.location = 'http://www.amstore-memory.co.uk';
    }
    if (document.webjump.site.value == "am mem uk") {
        window.location = 'http://www.amstore-memory.co.uk';
    }
    
}




this.imagePreview = function() {
    /* CONFIG */

    xOffset = 400;
    yOffset = -210;

    // these 2 variable determine popup's distance from the cursor
    // you might want to adjust to get the right result

    /* END CONFIG */

    $("a.preview").hover(function(e) {

        document.getElementById(this.id + "-1").innerHTML = "click for more information";
        var hoverPicture = document.getElementById("hoverPic-" + this.id).title;

        // var moreinfo = document.getElementById(this.id + "-1");
        ///moreinfo.style.visibility = "visible";

        //document.getElementById(this.id + "-1").style.display = "inline";

        this.t = this.title;
        this.title = "";
        var c = (this.t != "") ? "<br/>" + this.t : "";
        $("body").append("<p id='preview'><img src='" + hoverPicture + "' alt='Image preview' />" + c + "</p>");
        $("#preview")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function() {
	    this.title = this.t;
	    document.getElementById(this.id + "-1").innerHTML = "<span style='color:#FFFFFF'>.</span>";
	    $("#preview").remove();
	});
    $("a.preview").mousemove(function(e) {
        $("#preview")
			.css("top", (e.pageY - xOffset) + "px")
			.css("left", (e.pageX + yOffset) + "px");
    });
};


// starting the script on page load
$(document).ready(function(){
	imagePreview();
});
