﻿function overlaySearch() {
    if (document.getElementById("overlaySearch") != null) {
        document.getElementById("overlaySearch").style.visibility = "visible";
    }
}

        function overlaySearchclose() {
            document.getElementById('ctl00_ContentPlaceHolder1_lblSearch').style.display = "none";
            document.getElementById('ctl00_ContentPlaceHolder1_lblSearch').style.display = "none";
            document.getElementById("overlaySearch").style.visibility = "hidden";
        }
        function CheckSearch() {

            if (Page_ClientValidate("Search")) {
                overlaySearchclose();
            }
            else {

                overlaySearch();
            }
        }



        function fncEnterClick_Samashti(evt, BtnID)/*Where BtnID is clientid of the button*/{

            if ($.browser.msie) /*for ie*/
            {
                if (evt.keyCode == 13) {
                    if (document.getElementById('ctl00_ContentPlaceHolder1_txtSearch').value == '') {
                        document.getElementById('ctl00_ContentPlaceHolder1_lblSearch').style.display = "block";
                        overlaySearch();
                        return false;
                    }
                    document.getElementById(BtnID).click();
                }
            }
            else /*for firefox only*/
            {
                if (evt.which == 13) {
                    if (document.getElementById('ctl00_ContentPlaceHolder1_txtSearch').value == '') {
                        document.getElementById('ctl00_ContentPlaceHolder1_lblSearch').style.display = "block";
                        overlaySearch();
                        return false;
                    }
                    var btnid1 = BtnID.replace(/_/g, "$");
                    __doPostBack(btnid1, "");
                }
            }
        }

        function WatermarkFocus(txtElem, strWatermark) {
            if (txtElem.value == strWatermark) txtElem.value = '';
        }
        function WatermarkBlur(txtElem, strWatermark) {
            if (txtElem.value == '') txtElem.value = strWatermark;
        }

        function clickButton(e, buttonid, btname) {
            var evt = e ? e : window.event;

            var bt = document.getElementById(buttonid);

            if (bt) {
                if (evt.which == 13) {
                    __doPostBack(btname, '');
                    return false;
                }
                else if (evt.keyCode == 13) {
                    bt.click();
                    return false;
                }
            }
        }

        $(document).ready(function () {

            $(".watermark").focus(function () {

                if ($(this).val() == this.defaultValue) {

                    $(this).val("");
                }

            }

     ); $(".watermark").blur(function () {

         if ($.trim($(this).val()) == "") {

             $(this).val(this.defaultValue);
         }

     }

 );
        }

 );

 // set the delay between images
 var timeDelay
 var num = 0
 //for automatic Slideshow of the Images
 function VideoImageSlideShow(ImageId, hdThumbsList, Count, DefaultImage, Path) {

     var thumbs = document.getElementById(hdThumbsList).value;

     var thumnaillist = thumbs.split('|')

     if (Count == "0") {
         if (num < thumnaillist.length - 2) {
             num++
             //if last image is reached,display the first image
             if (num == thumnaillist.length)
                 num = 0

             //sets the timer value to 4 seconds,we can create a timing loop by using the setTimeout method
             timeDelay = setTimeout("ImageSlideShow('" + ImageId + "','" + hdThumbsList + "','" + Count + "','" + DefaultImage + "','" + Path + "')", 300)
             var ThumbUrl = Path + thumnaillist[num];
             document.getElementById(ImageId).src = ThumbUrl;
         }
     }
     if (Count == "1") {

         //Cancels the time-out that was set with the setTimeout method. 
         num = 0;
         clearTimeout(timeDelay);
         document.getElementById(ImageId).src = DefaultImage;
     }
 }

 function BindVideo(strVideoUrl, strVideoName, VideoId) {

     var strVideoEmbededScript = "";
     var strVideoId = "";
     var Videourl = "~/Uploads/PageVideos/" + strVideoUrl;
     var sbVideo = "";
     sbVideo += '<object id="monFlash" type="application/x-shockwave-flash" data="player_flv_maxi.swf" width="462"height="303">"';
     sbVideo += '<param name="movie" value="player_flv_maxi.swf" /><param name="wmode" value="transparent" />';
     sbVideo += '<param name="allowFullScreen" value="true" />';
     sbVideo += '<param name="FlashVars" value="flv=' + Videourl.replace("~/", "") + '&amp;autoplay=1&amp;showtime=1&amp;width=462&amp;height=303&amp;srt=1&amp;showstop=1&amp;showvolume=1&amp;title=' + strVideoName + '&amp;bgcolor1=000000&amp;bgcolor2=000000&amp;playercolor=000000&amp;buttoncolor=7cad3b&amp;buttonovercolor=E9B21A&amp;slidercolor1=7cad3b&amp;slidercolor2=B08614&amp;sliderovercolor=E9B21A&amp;loadingcolor=E9B21A&amp;titlesize=40&amp;showfullscreen=1" />';
     sbVideo += "<p>" + strVideoName + "</p></object>"; //ctl00_repVideos_ctl01_lbVideo;ctl00_repVideos_ctl00_lbtnVideoTitle
     var ThumbCount = document.getElementById('ctl00_ContentPlaceHolder1_hdfVideoCount').value
     if (ThumbCount > 0) {
         var i = 0;
         var lbVideo;
         var lbtnVideoTitle;

         if (strVideoUrl != "") {

             document.getElementById("lblHelpVideoName").innerHTML = strVideoName;
             document.getElementById('ctl00_ContentPlaceHolder1_divHelpVideo').style.display = "block";
             document.getElementById('ctl00_ContentPlaceHolder1_divHelpVideo').innerHTML = sbVideo;
         }
         EnablePopup('#VideoPopUp', '#backgroundPopup');

     }
     return false;
 }
 function VideoPopUpClose() {
     disablePopup('#VideoPopUp', '#backgroundPopup');
     var myPlayer = document.getElementById('monFlash');
     if (myPlayer != null) {
         document.monFlash.SetVariable("player:jsStop", "");
     }
 }
 // set the delay between images
 var timeDelay
 var num = 0
 //for automatic Slideshow of the Images
 function ImageSlideShow(ImageId, hdThumbsList, Count, DefaultImage, Path) {

     var thumbs = document.getElementById(hdThumbsList).value;
     //                            alert(thumbs);
     var thumnaillist = thumbs.split('|')

     if (Count == "0") {
         if (num < thumnaillist.length - 2) {
             num++
             //if last image is reached,display the first image
             if (num == (thumnaillist.length - 1))
                 num = 0

             //sets the timer value to 4 seconds,we can create a timing loop by using the setTimeout method
             timeDelay = setTimeout("ImageSlideShow('" + ImageId + "','" + hdThumbsList + "','" + Count + "','" + DefaultImage + "','" + Path + "')", 300)
             var ThumbUrl = thumnaillist[num];
             document.getElementById(ImageId).src = ThumbUrl;
         }
     }
     if (Count == "1") {

         //Cancels the time-out that was set with the setTimeout method. 
         num = 0;
         clearTimeout(timeDelay);
         document.getElementById(ImageId).src = DefaultImage;
         //                    alert(DefaultImage);
     }
 }
