﻿  //Function to add the Link and the Title of the Link in the Bookmark List

        function fnfav(url,title)
        {
            //url --> Site URL you want to add in the Bookmark List
            //title --> Title you want to display with the Bookmark
            switch(navigator.appName)
            {
                case "Microsoft Internet Explorer":
                    if((parseInt(navigator.appVersion) >= 4))
                        window.external.AddFavorite(url,title);
                    break;
                case "Netscape":
                    window.sidebar.addPanel(title,url,"");
                    break;
                default:
                {
                    alert("Press CTRL-D (Netscape) or CTRL-T (Opera) to bookmark");
                }
            }
        }
         function fillReviewPanel(title,name,location,rating,review)
        {
            document.getElementById('lblTitle').innerHTML=document.getElementById(title).value;
            document.getElementById('lblNickname').innerHTML=document.getElementById(name).value;
       
            document.getElementById('lblLocation').innerHTML=document.getElementById(location).value;
      
            document.getElementById('lblBody').innerHTML=document.getElementById(review).value;
           
            var RatingID = document.getElementById('ctl00_ContentPlaceHolder1_AddProductReviewsControl_ATrating_RatingExtender_ClientState').value;
            if(RatingID!=0)
            {
                for(i=1;i<6;i++)
                {
                 document.images['img'+i].style.display='none';
                }
          
            document.images['img'+RatingID].style.display='block';
            }

            var today=new Date();
            document.getElementById('lblDate').innerHTML=today.toLocaleString();
        }

       
        
        jQuery.fn.center = function() {
        return this.each(function() {
                var t = jQuery(this);
                t.css({position: 'fixed'});

                var w = t.width(), 
                        h = t.height(), 
                        lrPadding = parseInt(t.css('paddingLeft'), 10) + parseInt(t.css('paddingRight'), 10), 
                        lrBorder = parseInt(t.css('borderLeftWidth'), 10) + parseInt(t.css('borderRightWidth'), 10), 
                        tbPadding = parseInt(t.css('paddingTop'), 10) + parseInt(t.css('paddingBottom'), 10), 
                        tbBorder = parseInt(t.css('borderTopWidth'), 10) + parseInt(t.css('borderBottomWidth'), 10), 
                       // leftMargin = (w + lrPadding + lrBorder) / 2;
                       leftMargin = (GetWidth() - w)/4;
                       // alert('leftM: ' + leftMargin +'pageWidth: ' + GetWidth() +'Width: ' + w +'leftM: ');
                        topMargin = (h + tbPadding + tbBorder) / 2;


                t.css({
                        position: 'fixed', 
                        left: '40%', 
                        top: '40%', 
                        marginLeft: '-' +leftMargin +'px', 
                       // marginTop: '-' +topMargin +'px', 
                        zIndex: '200'
                });

        });
};


// Sizes

// Size Object
function Size()
{

}

Size.prototype._windowX;
Size.prototype._windowY;
Size.prototype._scrOfY;
Size.prototype._scrOfY;
//Get Sizes
function GetSizes()
{
//alert( getDocHeight());
    var result = new Size();
    
    result._windowX = GetWidth() ;
    result._windowY = GetHeight();    
    var scrolls = getScrollXY();
    result._scrOfX = scrolls._x;
    result._scrOfY = scrolls._y;
    result._y =getDocHeight();
    result._x = getDocWidth();
    //alert('x: ' + result._scrOfX +'y: ' + result._scrOfY+'Wx: ' + result._windowX+'Wy: ' + result._windowY);
    return result;
}
// window size
 function GetHeight()
        {
            var y = 0;
            if (window.innerHeight) {
                y=window.innerHeight;
            }
            else if (document.documentElement && document.documentElement.clientHeight) {
                y=document.documentElement.clientHeight;
            }
            else if (document.body) {
                y=document.body.clientHeight;
            }
            return y;
        }
        
        function GetWidth()
        {
                var x = 0;
                if (self.innerHeight)
                {
                        x = self.innerWidth;
                }
                else if (document.documentElement && document.documentElement.clientHeight)
                {
                        x = document.documentElement.clientWidth;
                }
                else if (document.body)
                {
                        x = document.body.clientWidth;
                }
                return x;
        }
// Brower size
function getScrollXY() {
    var result = new Size();
      var scrOfX = 0, scrOfY = 0;
      if( typeof( window.pageYOffset ) == 'number' ) {
        //Netscape compliant
        scrOfY = window.pageYOffset;
        scrOfX = window.pageXOffset;
      } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
        //DOM compliant
        scrOfY = document.body.scrollTop;
        scrOfX = document.body.scrollLeft;
      } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
        //IE6 standards compliant mode
        scrOfY = document.documentElement.scrollTop;
        scrOfX = document.documentElement.scrollLeft;
      }
      result._x= scrOfX;
        result._y = scrOfY;
      return result;
}
function getDocHeight() {
   var db = document.body;
   var dde = document.documentElement;
   return Math.max(db.scrollHeight, dde.scrollHeight, db.offsetHeight, dde.offsetHeight, db.clientHeight, dde.clientHeight)
}
function getDocWidth() {
   var db = document.body;
   var dde = document.documentElement;
   return Math.max(db.scrollWidth, dde.scrollWidth, db.offsetWidth, dde.offsetWidth, db.clientWidth, dde.clientWidth)
}