$(document).ready(function () {
    $("div[id$='__ControlWrapper_RichHtmlField'] ul").css('list-style-type', 'disc');
    $("div[id$='__ControlWrapper_RichHtmlField'] ul").css('margin-left', '20px');
});

function showDiv(arg, editDiv, msgDiv) {
    if(arg.hash == "#expand")
    {
        $('#' + editDiv).show();
        $('#' + msgDiv).hide();
        arg.innerHTML = "-";
        arg.hash = "#collapse";
	}
	else
	{
	    $('#' + editDiv).hide();
        $('#' + msgDiv).show();
        arg.innerHTML = "+";
        arg.hash = "#expand";
	}
}

function showVSeparator() {
    if(  jQuery.trim($('#LeftZoneId').html()) != "" && 
         jQuery.trim($('#RightZoneId').html()) != "")
            $('.vertseperator').show();
}

function checkPageDetails() {

    if ($("#pageSubTitle").children() != null && 
        $("#pageSubTitle").children().html() != null) 
    {
        var subTitle = $("#pageSubTitle").children().html().replace(/^\s+|\s+$/g, "").replace("&nbsp;", "");
        if (subTitle == "")
            $("#pageSubTitle").hide();
    }
    
    if($("#pageDescription").children() != null && $("#pageDescription").children().html() != null)
    {
		if ($("#pageDescription").children().html() == "")
			$("#pageDescription").hide();
        else 
		{
		    var tmp = $("#pageDescription .pageDescItal");
		    
		    if (tmp.length != 0 && tmp.children() != null)
		    {
		        if(tmp.children().html() != null && tmp.children().html() == "")
		            $("#pageDescription").hide();
		    }   
		}
    }
         
}

function updateSearchPagingStyle() {
    $('#SRP_Prev').css("background-color","#FFFFFF");
    $('#SRP_Prev').css("color","#7D7D7D");
    $('#SRP_Prev').css("font-size","10px");
    $('#SRP_Prev').css("margin-right","3px");

    $('#SRP_Next').css("background-color","#FFFFFF");
    $('#SRP_Next').css("color","#7D7D7D");
    $('#SRP_Next').css("font-size","10px");
    $('#SRP_Next').css("margin-left","3px");
}



this.Tooltip = function() {
    xOffset = 70;
    yOffset = 25;

    $("a.previewLink").hover(function(e) {
        this.t = this.title;
        this.r = this.rev;

        this.title = "";
        this.rev = "";

        var title = (this.t != "") ? this.t : "";
        var footer = (this.r != "") ? this.r : "";
        var imgPath = this.rel;

        if (this.rel != '') {
            $("body").append(
            "<div id='screenshot' class='contentPhotoHolder tooltip'>" +
                "<img class='previewArrow' src='/PublishingImages/preview_arrow.png'>" +
	            "<div class='previewTitle'>" + title + "</div>" +
	            "<div class='contentPhoto'><img alt='' src='" + imgPath + "'></div>" +
                "<div class='previewCaption'>" + footer + "</div>" +
            "</div>"
            );
        }
        else {
            $("body").append(
            "<div id='screenshot' class='contentPhotoHolder tooltip'>" +
                "<img class='previewArrow' src='/PublishingImages/preview_arrow.png'>" +
	            "<div class='previewTitle'>" + title + "</div>" +
	            "<div class='contentPhoto'></div>" +
                "<div class='previewCaption'>" + footer + "</div>" +
            "</div>"
            );
        }

        var left_pos, top_pos, arrow_pos;
        var Hdiv = $("#screenshot").height();

        top_pos = e.pageY - (Hdiv / 2) - yOffset;
        left_pos = e.pageX + xOffset;
        arrow_pos = (Hdiv / 2) - 23;

        $("#screenshot")
            .css("top", (top_pos) + "px")
            .css("left", (left_pos) + "px")
            .css("position", "absolute")
            .css("z-index", "3000")
            .fadeIn("fast");

        $(".previewArrow")
            .css("top", (arrow_pos) + "px");
    },

   	function() {
   	    this.title = this.t;
   	    this.rev = this.r;
   	    $("#screenshot").remove();
   	}
   	);

    //    $("a.previewLink").mousemove(function (e) {
    //        var Hdiv = $("#screenshot").height();
    //        var Hlnk = $(".previewLink").height();

    //        $("#screenshot")
    //                .css("top", (e.pageY - (Hdiv / 2) - (Hlnk / 2)) + "px")
    //        		.css("left", (e.pageX + xOffset) + "px");
    //    });
};


