﻿$(document).ready(
function() {
    LargeImage();
   
}
);

function JusttabClick(id) {



    $(document).ready(

    function() {



        var getID = id.id;

        if (getID == "Detail") {
            $("#DIV_Detail").slideDown(600);
            $("#DIV_Specs").hide();
            $(".btnSpecs").css({ 'background-color': '#E8EEF6','font-weight':'Normal' });
            $(".btnDetail").css({ 'background-color': '#B1C7E3', 'font-weight': 'bold' });

        }
        else {

            $("#DIV_Detail").hide();
            $("#DIV_Specs").slideDown(600);
            $(".btnSpecs").css({ 'background-color': '#B1C7E3', 'font-weight': 'bold' });
            $(".btnDetail").css({ 'background-color': '#E8EEF6', 'font-weight': 'Normal' });
        }

    }
   );
}
function divSwitch(id) {
    var getID = id;
    if (getID == "ddlSearch") {


        document.getElementById('ddlShow').style.display = 'block';
        document.getElementById('ddlblock').style.display = 'None';
        document.getElementById('btnpolystrapping').className = 'buttonDiv';
        document.getElementById('btnHillas').className = 'buttonDivActiv';
       
    }
    else if (getID == "other") {

    document.getElementById('ddlShow').style.display = 'None';
    document.getElementById('ddlblock').style.display = 'block';
    document.getElementById('btnpolystrapping').className = 'buttonDivActiv';
    document.getElementById('btnHillas').className = 'buttonDiv';
    }

}

function openwindow(ItemID, title) {
    var leftalign = screen.width - 500;
    var url = "GetThumbNail.aspx?Type=item&amp;image=" + ItemID + "&amp;Size=400&amp;site_Name=www.stretch-film.com"; 
    window.open(url, title, 'left='+leftalign+',top=20,width=500px,height=400px'); 
}

function selectIndex(searchText, siteID, siteName) {
    var ItemsPerPage = document.getElementById("ddlItemsperpage").value;
        var url = "SearchPage.aspx?SearchText=" + searchText + "&pageNum=1&SiteID=" + siteID + "&ItemsPerPage=" + ItemsPerPage + "&siteName=" + siteName;
        window.location = url;
    }

//////////////////////image magnify///////////////////////

    function LargeImage() {

        this.imagePreview = function() {
       
            /* CONFIG */

            xOffset = 250;
            yOffset = -420;

            // 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) {
            this.t = this.title;
            this.title = "";
                var c = (this.t != "") ? "<br/>" + this.t : "";
                $("body").append("<p id='preview'><img src='" + this.href + "' alt='Image preview' />" + c + "</p>");
                $("#preview")
                			.css("top", (e.pageY - xOffset) + "px")
                			.css("left", (e.pageX + yOffset) + "px")
			//.css("top", 100 + "px")
			//.css("left", 420 + "px")
			.fadeIn("slow");
            },
	function() {
	    this.title = this.t;
	    $("#preview").remove();
	});
            $("a.preview").mousemove(function(e) {
                $("#preview")
                		.css("top", (e.pageY - xOffset) + "px")
                		.css("left", (e.pageX + yOffset) + "px")
			//.css("top", 100 + "px")
			//.css("left", 420 + "px")
			.fadeIn("slow");
            });
        };


        // starting the script on page load
        $(document).ready(function() {
            imagePreview();
        });
    }

    function searchText() {

        var sText = document.getElementById("txtSearch").value;

        var siteindex = document.getElementById("ddlSearch").selectedIndex;
        var siteID = document.getElementById("ddlSearch").options[siteindex].value;

        document.location = "Search.aspx?PageNo=1&SiteID=" + siteID + "&SearchTerm=" + sText;


    }
    function getPageNoForCategory(getsiteid, divIDPageNo, getParam, totalpages, siteDistinct) {

        var c = 0;
        var pageID = "";
        for (c = 0; c < totalpages; c++) {
            pageID = "pageNo" + (c + 1) + "_" + siteDistinct;

            document.getElementById(pageID).style.backgroundColor = 'White';
            document.getElementById(pageID).style.color = 'Black';


        }
        document.getElementById(getsiteid.id).style.backgroundColor = '#D7E8FE';
        document.getElementById(getsiteid.id + "TD").style.color = 'Red';

        document.getElementById(divIDPageNo).innerHTML = "<div style='width:100%;height:200px;padding-top:100px;;text-align:center;font-size:14px;font-weight:bold;'><lable style='width:50px; height:50px;border:solid 5px gray;'>Wait...</lable></div>";
        $.ajax({
            url: "searchResultForCategory.aspx?searchText=" + encodeURIComponent(getParam),
            cache: true,
            async: true,
            success: function(data) {
                $("body").css("cursor", "default");
                //$("#ajaxImage").html("");
                $("#" + divIDPageNo).html(data);
            }
        });
    }



    function getPageNo(getsiteid, divIDPageNo, getParam, totalpages, siteDistinct) {

        var c = 0;
        var pageID = "";
        var tdd = "";
        getParam = getParam.replace("$&", " ")

        for (c = 0; c < totalpages; c++) {
            pageID = "pageNo" + (c + 1) + "_" + siteDistinct + "TD";

            tdd = pageID = "pageNo" + (c + 1) + "_" + siteDistinct;
            document.getElementById(tdd).style.backgroundColor = 'White';
            document.getElementById(pageID).style.backgroundColor = 'White';
            document.getElementById(getsiteid.id + "TD").style.color = 'Black';
            document.getElementById(getsiteid.id).style.backgroundColor = 'White';
           

        }
        document.getElementById(getsiteid.id).style.backgroundColor = '#D7E8FE';
        document.getElementById(getsiteid.id).style.color = 'Red';


        document.getElementById(divIDPageNo).innerHTML = "<div style='width:100%;height:200px;padding-top:100px;;text-align:center;font-size:14px;font-weight:bold;'><lable style='width:50px; height:50px;border:solid 5px gray;'>Wait...</lable></div>";
        $.ajax({
            url: "searchResult.aspx?searchText=" + encodeURIComponent(getParam),
            cache: true,
            async: true,
            success: function(data) {
                $("body").css("cursor", "default");
                //$("#ajaxImage").html("");
                $("#" + divIDPageNo).html(data);
            }
            
        });
    }



    function CategoryTabs(id) {



        $(document).ready(

    function() {



        var getID = id.id;

        if (getID == "videoHeading") {
            $("#videoDetail").slideDown(600);
            $("#specDetial").hide();
            $("#videoHeading").css({ 'background-color': '#6598DA', 'font-weight': 'bold', 'color': 'white' });
            $("#specHeading").css({ 'background-color': '#D7E8FE', 'font-weight': 'normal', 'color': 'black' });

        }
        else {
           
            $("#videoDetail").hide();
            $("#specDetial").slideDown(600);
//            $("#specHeading").css({ 'background-color': '#6598DA', 'font-weight': 'bold' });
//            $("#videoHeading").css({ 'background-color': '#E8EEF6', 'font-weight': 'Normal' });

            $("#specHeading").css({ 'background-color': '#6598DA', 'font-weight': 'bold', 'color': 'white' });
            $("#videoHeading").css({ 'background-color': '#D7E8FE', 'font-weight': 'normal', 'color': 'black' });
        }

    }
   );
}


function showvideo() {
    if (document.getElementById('div_iframe_video')) {
        if (document.getElementById('div_iframe_video').style.display == 'none') {
            document.getElementById('div_iframe_video').style.display = 'inline';
        }
        else {
            document.getElementById('div_iframe_video').style.display = 'none';
        }
    }
}
