﻿
var scroller_widget = new Class({
    current_overlay: -1,
    timer_overlay_show: null,
    timer_overlay_hide: null,
    nav_set_current: 0,
    nav_set_max: 0,
    overlays: [],
    buttons: [],
    evt_button_mouseenter: function(index, context) {
        //alert(index)
        // console.log('evt_button_mouseenter for ' + index);
        // console.log('current_overlay ' + context.current_overlay);
        context.cmd_hide_overlay_stop();
        context.current_overlay = index;
        context.cmd_show_overlay_with_delay();
        context.cmd_update_overlay();
        // console.log(context.current_overlay);
    },
    evt_movePrev_click: function(context) {
        // console.log('evt_movePrev_click');		
        if ((context.nav_set_current - 1) >= 0) {
            context.nav_set_current -= 1;
            context.cmd_update_nav_set();
            context.cmd_hide_overlay();

        }
    },
    evt_moveNext_click: function(context) {
        // console.log('evt_moveNext_click');				
        if ((context.nav_set_current + 1) <= context.nav_set_max) {

            context.nav_set_current += 1;
            context.cmd_update_nav_set();
            context.cmd_hide_overlay();

        }
    },
    evt_widget_mouseleave: function(context) {
        // console.log('evt_widget_mouseleave');
        context.cmd_hide_overlay_with_delay();

        context.cmd_show_overlay_stop();

    },
    evt_widget_mouseenter: function(context) {
        // console.log('evt_feature_mouseenter');
        context.cmd_hide_overlay_stop();
    },
    cmd_show_overlay_with_delay: function() {
        // console.log('cmd_show_overlay_with_delay');
        this.timer_overlay_show = this.cmd_show_overlay.delay(500);
    },
    cmd_show_overlay: function() {
        // console.log('cmd_show_overlay');
        if ($E('.feature').style.opacity != 1) {
            var fx = new Fx.Style($E('.feature'), 'opacity', { duration: 500 }).start(0, 1);
            // $E('.feature').setStyle('display','block');
        }
    },
    cmd_show_overlay_stop: function() {
        // console.log('cmd_hide_overlay_stop');
        $clear(this.timer_overlay_show);
    },
    cmd_hide_overlay_with_delay: function() {
        // console.log('cmd_hide_overlay_with_delay');
        this.timer_overlay_hide = this.cmd_hide_overlay.delay(500);
    },
    cmd_hide_overlay: function() {
        // console.log('cmd_hide_overlay');
        // console.log('current_overlay ' + this.current_overlay);
        var elOpacity = $E('.feature').getStyle("opacity");
        if (elOpacity > 0.05) {
            var fx = new Fx.Style($E('.feature'), 'opacity', { duration: 500 }).start(1, 0);
        }
        this.current_overlay = -1;

        // $E('.feature').setStyle('display','none');				
    },
    cmd_hide_overlay_stop: function() {
        // console.log('cmd_hide_overlay_stop');
        $clear(this.timer_overlay_hide);
    },
    cmd_update_overlay: function() {
        //shipra 11/07/08
        if (this.current_overlay == CurrentStartIndex) {
            $E('.feature').setStyle('left', '10px');
            $E('.connector').setStyle('left', '20px');
            //$E('.connector').setStyle('height','50px');

            // $E('.feature').setStyle('left','50px');
            // $E('.connector').setStyle('left','10px');

        }
        else if (this.current_overlay == CurrentStartIndex + 1) {
            $E('.feature').setStyle('left', '10px');
            $E('.connector').setStyle('left', '120px');
            // $E('.connector').setStyle('height','60px');
        }
        else if (this.current_overlay == CurrentStartIndex + 2) {
            $E('.connector').setStyle('left', '120px');
            $E('.feature').setStyle('left', '113px');
            //$E('.connector').setStyle('height','60px');	
            //$E('.connector').setStyle('left','83px');	
            //$E('.feature').setStyle('left','180px');	

        }
        else if (this.current_overlay == CurrentStartIndex + 3) {
            $E('.connector').setStyle('left', '120px');
            $E('.feature').setStyle('left', '216px');
            // $E('.connector').setStyle('height','55px');

            //	          $E('.connector').setStyle('left','185px');	
            //	          $E('.feature').setStyle('left','180px');

        }
        else if (this.current_overlay == CurrentStartIndex + 4) {
            $E('.connector').setStyle('left', '133px');
            $E('.feature').setStyle('left', '306px');
            // $E('.connector').setStyle('height','55px');
            // $E('.connector').setStyle('left','150px');	
            //$E('.feature').setStyle('left','315px');

        }
        else if (this.current_overlay == CurrentStartIndex + 5) {
            $E('.connector').setStyle('left', '233px');
            //$E('.connector').setStyle('height','60px');	
            $E('.feature').setStyle('left', '306px');
            //$E('.connector').setStyle('left','245px');	
            //$E('.feature').setStyle('left','315px');

        }
        //		if((this.current_overlay % 6) > 3)
        //		 {
        //		   
        //			$E('.feature').setStyle('left','120px');
        //			$E('.connector').setStyle('left',(((this.current_overlay % 6) * 102) - 65)+'px');
        //		}
        //		 else
        //		  {
        //		    
        //			$E('.feature').setStyle('left','20px');	
        //			$E('.connector').setStyle('left',(((this.current_overlay % 6) * 102) + 40)+'px');
        //							
        //		
        //		}//		




    },
    cmd_update_nav_set: function() {
        //$E('.home-scroller-list').setStyle('left','312px');
        //$E('.home-scroller-list').setStyle('left',(1 * -152) + 'px');
        //alert(this.nav_set_current);
        // $E('.home-scroller-list').setStyle('left',(this.nav_set_current * -612) + 'px');
        //logic here
        //var leftOffset = (this.nav_set_current * -612);

        //var myEffects = new Fx.Styles($E('.home-scroller-list'), {duration: 1000, transition: Fx.Transitions.expoOut});
        //myEffects.start({ 'left': -612 });


    },
    initialize: function() {
        this.buttons = $ES('.home-scroller-list img');

        this.overlays = $ES('li.overlay-panel');


        this.buttons.each(function(el, index) {
            el.addEvent('mouseenter', this.evt_button_mouseenter.pass([index, this]));
        }, this);

        //$E('a.left-arrow').addEvent('click', this.evt_movePrev_click.pass([this]));
        //$E('a.right-arrow').addEvent('click', this.evt_moveNext_click.pass([this]));

        $E('.scroller').addEvent('mouseenter', this.evt_widget_mouseenter.pass([this]));

        $E('.scroller').addEvent('mouseleave', this.evt_widget_mouseleave.pass([this]));

        $E('.feature').addEvent('mouseenter', this.evt_widget_mouseenter.pass([this]));

        $E('.feature').addEvent('mouseleave', this.evt_widget_mouseleave.pass([this]));

        this.nav_set_max = parseInt((this.buttons.length - 1) / 6);


        this.cmd_hide_overlay();
        // // console.log(this.nav_set_max);
    }
});

/* ***************************************************************************************************************
/* Description : NavBar 
Created By : Shipra
Created On : June 3 , 2008
     
*/
var TotalImage = 0;
var CurrentStartIndex = 0;
var CurrentEndIndex = 5;
var LeftSlide = 0;
var RightSlide;
var t;
//Hide Popup

function hidefeature() {
    //clearTimeout(t);
    t = setTimeout('hide_popup()', 0);
}
function hide_popup() {

    var elOpacity = $E('.feature').getStyle("opacity");
    if (elOpacity > 0.05) {
        var fx = new Fx.Style($E('.feature'), 'opacity', { duration: 10 }).start(1, 0);
    }
}


// Right navigation functionality for images   

function RightDisplay() {
    //shipra 11/07/08
    hide_popup();
    if (CurrentEndIndex != (TotalImage - 1)) {
        // alert(document.getElementById('ctl00_ContentPlaceHolder1_Hidden1').value);
        TotalImage = document.getElementById('ctl00_ContentPlaceHolder1_Hidden1').value;
        //TotalImage= document.getElementById('ctl00$ContentPlaceHolder1$Hidden1').value;
        if (CurrentEndIndex + 6 < TotalImage - 1) {

            CurrentEndIndex = CurrentEndIndex + 6;
            CurrentStartIndex = CurrentEndIndex - 5;
            RightSlide = -(CurrentStartIndex * 100 + 12);

            $E('.home-scroller-list').setStyle('left', LeftSlide + 'px');
            var myeffects = new Fx.Styles($('ullist'), { duration: 2500, transition: Fx.Transitions.expoOut });
            myeffects.start({ 'left': RightSlide });
        }

        else if (CurrentEndIndex + 6 == TotalImage - 1) {
            //finding start index
            CurrentStartIndex = CurrentStartIndex + 6;
            //finding end index
            CurrentEndIndex = CurrentStartIndex + 5;
            // calculate position for start index    
            RightSlide = -(CurrentStartIndex * 100 + 12);

        }
        else if (CurrentEndIndex + 6 > TotalImage - 1) {
            //finding start index      
            CurrentStartIndex = TotalImage - 6;
            //finding end index
            CurrentEndIndex = TotalImage - 1;
            RightSlide = -(CurrentStartIndex * 100 + 16);
        }


        //sliding  brand window  with timer           

        $E('.home-scroller-list').setStyle('left', LeftSlide + 'px');
        var myeffects = new Fx.Styles($('ullist'), { duration: 2500, transition: Fx.Transitions.expoOut });
        myeffects.start({ 'left': RightSlide });

    }

}

// Left navigation functionality for images   

function LeftDisplay() {
    //shipra 11/07/08
    hide_popup();
    if (CurrentStartIndex != 0) {
        //'<%= txtFirstName.ClientID %>' ctl00_ContentPlaceHolder1_Hidden1
        //alert(document.getElementById('<%= Hidden1.ClientID %>').value);
        TotalImage = document.getElementById('ctl00_ContentPlaceHolder1_Hidden1').value;
        //TotalImage= document.getElementById('<%= Hidden1.ClientID %>').value; 
        //TotalImage= document.getElementById('ctl00$ContentPlaceHolder1$Hidden1').value;          
        Temp_remain = TotalImage % 6;
        if (CurrentEndIndex == TotalImage - 1) {
            if (Temp_remain != 0) {
                CurrentStartIndex = CurrentStartIndex - Temp_remain;
                CurrentEndIndex = CurrentStartIndex + 5;
            }
            else if (Temp_remain == 0) {
                CurrentStartIndex = CurrentStartIndex - 6;
                //CurrentEndIndex=CurrentStartIndex+6; 
                CurrentEndIndex = CurrentStartIndex + 5;
            }
            LeftSlide = (CurrentStartIndex * 100 + 12);


        }
        else if (CurrentEndIndex != TotalImage - 1) {
            CurrentStartIndex = CurrentStartIndex - 6;
            if (CurrentStartIndex < 0)
                CurrentStartIndex = 0;
            CurrentEndIndex = CurrentStartIndex + 5;
        }
        //shipra 11/07/08
        if (CurrentStartIndex == 6) {
            LeftSlide = (CurrentStartIndex * 100 + 12);
        }
        else {
            LeftSlide = (CurrentStartIndex * 100);
        }
        //LeftSlide =( CurrentStartIndex*100-12); 
        $E('.home-scroller-list').setStyle('left', RightSlide + 'px');
        var myeffects = new Fx.Styles($('ullist'), { duration: 2500, transition: Fx.Transitions.expoOut });
        myeffects.start({ 'left': -LeftSlide });

    }


}


/*   ***************************************************************************************************************

Description : Slide Show in Home page
Created By : Vasanth
Created On : May 27 , 2008
     
*/

// The list of images to display in the slideshow
//creating a array of the image object
//var _ImagePath=new Array("Images/home/1.jpg","Images/home/2.jpg","Images/home/3.jpg")
//Global varaibles
var _ImageName;
var _ImagePath;
var _ImageURL;
var _ImagePlayPause = new Array("Images/home/play.gif",
                        "Images/home/hero_pause.gif"
                        )
//variable that will increment through the images
var num = 0;

// set the delay between images
var timeDelay;

var highlighting;

var string = "";

var baseopacity = 50

var browserdetect = navigator.appName;
var imgobj;

function instantset(which2, degree) {
    imgobj = which2
    imgobj.style.MozOpacity = degree / 100
}

function gradualfade(cur2) {
    if (cur2.style.MozOpacity < 1)
        cur2.style.MozOpacity = Math.min(parseFloat(cur2.style.MozOpacity) + 0.1, 0.99)
    else {
        imgobj.style.MozOpacity = baseopacity / 100
        clearInterval(highlighting)
    }

}

//preload the images in the cache so that the images load faster
//create new instance of images in memory 

//function to get the previous image in the array
function previous_image() {
    try {
        var imgSlideShow = document.getElementById('imgPlayPause');
        if (imgSlideShow.src.indexOf('pause') == -1 || imgSlideShow.src.indexOf('pause') == 47) {
            //code to execute only when the automatic slideshow is disabled 
            if (num > 0) {
                num--
                if (isFileExists(_ImagePath[num]))//If the images is available go inside , otherwise move to next
                {
                    //Change the Fad Effects by Apply
                    applyeffect(document.images.photoslider)
                    //Bind the Images
                    document.images.photoslider.src = _ImagePath[num]
                    //To play the effects
                    //playeffect()
                    //Set the href
                    document.getElementById('anchSlideShow').href = _ImageURL[num]
                    //Keep Track in status bar
                    // window.status = "Welcome to Amway  Slide Show Process :  " + _ImageName[num]
                    return false;
                }
            }
            if (num == 0) {  //if first image is displayed
                num = _ImagePath.length
                num--
                if (isFileExists(_ImagePath[num]))//If the images is available go inside , otherwise move to next
                {
                    //Change the Fad Effects by Apply
                    applyeffect(document.images.photoslider)
                    //Bind the Images
                    document.images.photoslider.src = _ImagePath[num]
                    //To play the effects
                    //playeffect()
                    //Set the href
                    document.getElementById('anchSlideShow').href = _ImageURL[num]
                    //Keep Track in status bar
                    //window.status = "Welcome to Amway  Slide Show Process :  " + _ImageName[num]
                    return false;
                }
            }
        }
        else {
            clearTimeout(timeDelay);
            imgSlideShow.src = _ImagePlayPause[0];
            imgSlideShow.alt = "Play";
            imgSlideShow.title = "Play";
            applyeffect(document.images.photoslider);
            document.images.photoslider.src = _ImagePath[num]
        }
        return false;
    }
    catch (err) {
        return false;
    }
}

//function to get the next image in the array
function next_image() {
    //code to execute only when the automatic slideshow is disabled
    var imgSlideShow = document.getElementById('imgPlayPause');
    //alert(imgSlideShow.src.indexOf('pause'))
    if (imgSlideShow.src.indexOf('pause') == -1 || imgSlideShow.src.indexOf('pause') == 47) {
        if (num < _ImagePath.length) {
            num++
            //if last image is reached,display the first image
            if (num == _ImagePath.length)
                num = 0
            //image_effects()
            if (isFileExists(_ImagePath[num]))//If the images is available go inside , otherwise move to next
            {
                //Change the Fad Effects by Apply
                applyeffect(document.images.photoslider)
                //Bind the Images
                document.images.photoslider.src = _ImagePath[num]
                //To play the effects
                //playeffect()
                //Set the href
                document.getElementById('anchSlideShow').href = _ImageURL[num]
                //Keep Track in status bar
                //window.status = "Welcome to Amway  Slide Show Process :  " + _ImageName[num]
            }
        }
    }
    else {
        clearTimeout(timeDelay);
        imgSlideShow.src = _ImagePlayPause[0];
        imgSlideShow.alt = "Play";
        imgSlideShow.title = "Play";
        applyeffect(document.images.photoslider);
        document.images.photoslider.src = _ImagePath[num]
    }
    return false;
}


//for automatic Slideshow of the Images
function slideshow_automatic(iFlag) {
    try {
        if (iFlag != 1) {
            if (isFileExists(_ImagePath[num]))//If the images is available go inside , otherwise move to next
            {
                //Change the Fad Effects by Apply
                applyeffect(document.images.photoslider)
                //Bind the Images

                document.images.photoslider.src = _ImagePath[num] // slideShowImages[num] 
                //To play the effects
                //playeffect()
                //Set the href
                document.getElementById('anchSlideShow').href = _ImageURL[num]
                //Keep Track in status bar
                //window.status = "Welcome to Amway  Slide Show Process :  " + _ImageName[num]
                if (num < _ImagePath.length - 1) {
                    num++;
                    string = "slideshow_automatic('0')";
                    timeDelay = setTimeout(string, 5000);
                }
                else {
                    num = 0;
                    string = "slideshow_automatic('0')";
                    timeDelay = setTimeout(string, 5000);


                }
            }
        }

    }
    catch (err) {
        //alert(err);
    }
}
function applyeffect(which2) {
    imgobj = which2
    var browserName = navigator.appName;
    if (browserName == "Microsoft Internet Explorer") {
        if (document.all && document.images.photoslider.filters) {
            //document.images.photoslider.filters[0].Stop();
            document.images.photoslider.style.filter = "blendTrans(duration=0.3)";
            document.images.photoslider.filters.blendTrans(duration = 0.3).Apply();
            document.images.photoslider.filters.blendTrans.Play();

        }
    }
    else if (browserName == "Netscape") {
        instantset(imgobj, baseopacity)
        //string=""
        clearInterval(highlighting)
        highlighting = setInterval("gradualfade(imgobj)", 100)


    }

}
function playeffect() {
    if (document.all && document.images.photoslider.filters)
        document.images.photoslider.filters.blendTrans.Play();
    //document.images.photoslider.filters.revealTrans.play();
}

function PlayPause(obj) {
    flagobj = obj
    try {
        var imgSlideShow = document.getElementById('imgPlayPause');
        //alert(obj);
        if (imgSlideShow.src.indexOf('pause') == -1) {
            //Starts the playing
            imgSlideShow.src = _ImagePlayPause[1];
            imgSlideShow.alt = "Pause";
            imgSlideShow.title = "Pause";
            //sathiya priya UAT fixes on 14 Aug
            //slideshow_automatic('1');
            setTimeout("slideshow_automatic(flagobj)", 0)
            //clearTimeout(timeDelay);

        }
        else {
            //Stop the playing and move forward and backword
            imgSlideShow.src = _ImagePlayPause[0];
            imgSlideShow.alt = "Play";
            imgSlideShow.title = "Play";
            clearTimeout(timeDelay);
            //timeDelay=setTimeout("slideshow_automatic('0')",0)
        }
        return false;
    }
    catch (err) {
        return false;
    }
}



//Check the File is exists or not in the server
function isFileExists(str) {
    return true;
    var O = AJ();
    if (!O)
        return false;
    try {
        O.open("HEAD", str, false);
        O.send(null);
        return (O.status == 200) ? true : false;
    }
    catch (er) {
        return false;
    }
}
function AJ() {
    var obj;
    if (window.XMLHttpRequest)
        obj = new XMLHttpRequest();
    else //if (window.ActiveXObject) 
    {
        try {
            obj = new ActiveXObject('MSXML2.XMLHTTP.3.0');
            //obj= new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (er) {
            obj = false;
        }
    }
    return obj;
}



/* Description : Calling Web Method and fetch from the database SlideShow Values 
Created By  : Vasanth
Created On  : May 28 , 2008
*/


var slideShowImages = new Array();
//preloadSlideShowImages(result.split('%')[1]);
function preloadSlideShowImages() {
    try {
        var imagesplit = preloadSlideShowImages.arguments[0].split("|");
        for (i = 0; i < imagesplit.length; i++) {
            slideShowImages[i] = new Image();
            slideShowImages[i].src = imagesplit[i];
        }
    }
    catch (err) {
        alert(err);
    }
}



function GetSlideShowInfoDisplay(id) {
    t = setTimeout('hide_popup()', 0);
    clearInterval(t);
    try {
        //Here we assign the output in the global varaibles
        var result = document.getElementById(id).value;
        //alert(result);
        var divHero_widget = document.getElementById('divHero_Widget');
        divHero_widget.style.display = 'none';
        if (isNaN(result)) {
            if (result.split('%').length == 4) {
                _ImageName = result.split('%')[0].split('|'); //Name
                _ImagePath = result.split('%')[1].split('|'); //Path
                preloadSlideShowImages(result.split('%')[1]);
                _ImageURL = result.split('%')[2].split('|'); //URL
            }
            else
                return;
            if (_ImageName.length == 1) {
                slideshow_automatic('0');
                return;
            }
            if (_ImageName.length > 0) {
                divHero_widget.style.display = '';
                //alert("No of images" + _ImageName.length);
                slideshow_automatic('0');
            }
        }
        else {
            //Bind the Images
            document.images.photoslider.src = "Images/home/home_pg_bg.GIF"
            //Set the href
            document.getElementById('anchSlideShow').href = "#"
        }

    }
    catch (err) {
        alert('getslideshow'+err);
        return;
    }
}

// 3. If Failed  
function OnFail(error, userContext, methodName) {
    //alert("Failed to show SlideShow");
    //Bind the Images
    document.images.photoslider.src = "Images/home/1.jpg"
    //Set the href
    document.getElementById('anchSlideShow').href = "#"
}
/*   ***************************************************************************************************************  */
/* 
Created by      :  Anitha
Created date    :   02-05-2008
Description     :   Expand / Collapse PV/BV  Home page
*/

/*Moving from inline script*/
function showHide(sourceObject, sourceImage) {
    //alert("hello");
    try {
        var divElement = document.getElementById(sourceObject);
        var imgElement = document.getElementById(sourceImage);
        if (divElement != null && imgElement != null) {
            if (divElement.style.display != 'none') {
                divElement.style.display = 'none';
                imgElement.src = "Images/Common/expand_box.gif";
                imgElement.alt = "Expand";
                imgElement.title = "Expand"
                //alert(imgElement.title);S
            }
            else {
                divElement.style.display = '';
                imgElement.src = "Images/Common/collapse-box.gif";
                imgElement.alt = "Collapse";
                imgElement.title = "Collapse";
                //alert(imgElement.title);S
            }
        }
    }
    catch (e) { }
}




/*  -------------   Added for HomePage inline scripts  -------------*/


                     
var ImagePathnav;
var hdn_SlideShow;
var PopImg;
var lblProduct;
var LinkPage;
var divCategory;
var imageObj = new Array();
var myimages = new Array();

function FuncitonCall(pImagePathnav,phdn_SlideShow, pPopImg, plblProduct, pLinkPage, pdivCategory)
{
     ImagePathnav =pImagePathnav; 
     hdn_SlideShow=  phdn_SlideShow;
     PopImg =  pPopImg;
     lblProduct=plblProduct;
     LinkPage=pLinkPage;
     divCategory=pdivCategory;
     
     GetSlideShowInfoDisplay(hdn_SlideShow);
     pageload();
     preloader(); 
     PlayPause(1);   
}

 

        function preloadimages() {
            try {
                var imagesplit = preloadimages.arguments[0].split(",");
                for (i = 0; i < imagesplit.length; i++) {
                    myimages[i] = new Image();
                    myimages[i].src = imagesplit[i];
                }
            }
            catch (err) {
                //alert(err);
            }
        }

        function pageload() {
        
            var scroll = new scroller_widget();
            document.getElementById("feature").style.display = "none";
            preload();
        }

//        GetSlideShowInfoDisplay(hdn_SlideShow);
//        pageload();

        function preload() {
            var imagepatharr = document.getElementById(ImagePathnav).value;
            preloadimages(imagepatharr);
        }

        var productdes;
        var imgpath;
        var productname;
        var maxno = 7;
        var temp = "And more..";
        var producturlname;

        function popup(displayname, relatedproduct, productdes, imgpath, productname, url) {

            //alert('Brand moving'); 
            document.getElementById(PopImg).src = '';
            document.getElementById(lblProduct).innerHTML = '';
            document.getElementById(PopImg).src = '';
            document.getElementById(lblProduct).innerHTML = '';
            ProductPopup(relatedproduct);
            document.getElementById("feature").style.display = "block";

            document.getElementById(PopImg).src = imgpath;
            document.getElementById(lblProduct).innerHTML = productdes;
            var path = "Shopping/ProductsListing.aspx?ctg=";
            path += productname;
            if (url.length != 0 && productname.length != 0) {
                document.getElementById(LinkPage).innerHTML = "Start  Shopping" + " " + displayname;
                document.getElementById(LinkPage).href = url;
            }
            else if (url.length != 0 && productname.length == 0) {
                document.getElementById(LinkPage).innerHTML = "Start  Shopping" + " " + displayname;
                document.getElementById(LinkPage).href = url;
            }
            else if (url.length == 0 && productname.length != 0) {
                // document.getElementById('<%=Linkpage.ClientID%>').innerHTML ="Start  Shopping"+" "+ productname;
                document.getElementById(LinkPage).innerHTML = "Start  Shopping" + " " + displayname;
                document.getElementById(LinkPage).href = path;
            }
            else if (url.length == 0 && productname.length == 0) {
                document.getElementById(LinkPage).innerHTML = "";
                document.getElementById(LinkPage).href = "javascript:void(0)";
            }
            path = '';
        }

        function ProductPopup(relatedproduct) {
            var product = relatedproduct;
            var result = relatedproduct.split("|");
            if (result != null && result.length > 0) {
                var sHTML = "<div style='font-size:0.95em; font-family:Arial Sans-serif Helvetica; width:98%;'>";
                sHTML += "<ul style='width:100%;'>"
                for (arr_count = 0; arr_count < result.length; arr_count++) {

                    var result1 = result[arr_count].split(":");
                    //alert(result1[0])
                    sHTML += "<li class='test' style='line-height:20px;width:45%; float:left; display:block;margin:0;padding:0'><a href=Shopping/ProductsListing.aspx?ctg=" + result1[1] + " >" + result1[0] + "</a></li> ";
                    //sHTML += "<li class='test' style='line-height:20px;width:45%; float:left; display:block;margin:0;padding:0'><a href=Shopping/ProductsListing.aspx?ctg="+result[arr_count]+" >"+result[arr_count]+"</a></li> "; 

                    if (arr_count > maxno) {
                        sHTML += "<li class='test' style='width:45%; float:left; display:block;margin:0;padding:0'>" + temp + "</li>";
                    }
                }
                sHTML += "<ul>";
                sHTML += "</div>";
                document.getElementById(divCategory).innerHTML = sHTML;
            }
        }


        //PlayPause(1);   
        
        
        function preloader() 
        {
            // counter 
            try
            {
                var i = 0;
                
                // set image list
                var images = new Array();                
                images[0]="Images/Common/collapse-box.gif";  
                images[1]="Images/buttons/previous_gray.gif";  
                images[2]="Images/buttons/next_gray.gif" ; 
                images[3]="Images/Common/nav_bg_hover.gif";
                images[4]="Images/buttons/previous.gif";
                images[5]="Images/buttons/next.gif";
                images[6]="Images/Common/TrashRED.gif";
                images[7]="Images/common/TrashBLUE.gif";
                images[8]="Images/home/play.gif";
                images[9]="Images/home/hero_pause.gif";
                images[10]="Images/buttons/Add-toStandingOrder_hvr.gif";
                images[11]="Images/buttons/Donate_DarkBlue.gif";

                // start preloading  
                for(i=0; i<=images.length; i++)   
                {      
                    imageObj[i] = new Image();
                    imageObj[i].src=images[i];   
                }
            }
            catch(error)
            {
               
            }

        } 

        function DeleteMessage()
        {
            var Confirm = window.confirm("Do You want to delete this Message ?" );
            if(Confirm)
            {
                return true;
            }
            else
            {
                 return false;
            }
        }
        
        
//     /*-----------   HomePage inline scripts code ends ----------------------*/


