
/*This file created to add site js functions */

//Video Popup
var modalWindow;

function popPage(source, width, height)
{
if (width == null)
	width = 600;
if (height == null)
	height = 400;
modalWindow.windowId = "Modal";
modalWindow.width = width;
modalWindow.height = height;
modalWindow.content = "<iframe allowTransparency='true' width='" + width + "' height='" + height + "' frameborder='0' scrolling='no' src='" + source + "'></iframe>";
modalWindow.open();
};

modalWindow = {
parent: "body",
windowId: null,
content: null,
width: null,
height: null,
close: function()
{
	$(".modal-window").remove();
	$(".modal-overlay").remove();
},
open: function()
{
	//margin-top:-" + (this.height / 2) + "px;
	var modal = "";
	modal += "<div id=\"modalBack\" class=\"modal-overlay\" onmousewheel=\"return false;\"></div>";
	modal += "<div id=\"" + this.windowId + "\" class=\"modal-window\" style=\"position:absolute;width:" + this.width + "px; height:" + this.height + "px; margin-top:0px;  margin-left:-" + (this.width / 2) + "px;\">";
	modal += this.content;
	modal += "</div>";

	$(this.parent).append(modal);
	
	/* adds a button to the html, button is now in flash, so HTML button is unnecessary
	var isIE6 = /msie|MSIE 6/.test(navigator.userAgent);
			if(isIE6)
			{
	        	$(".modal-window").append("<div style=\"position:absolute;bottom:357px;left:437px;\"><a class=\"close-window\" href=\"#\"><img src=\"/PublishingImages/btn_close.gif\" /></a></div>");
	        }
	        else
	        {
	        	$(".modal-window").append("<div style=\"position:absolute;bottom:361px;left:428px;\"><a class=\"close-window\" href=\"#\"><img src=\"/PublishingImages/btn_close.gif\" /></a></div>");	        	
	        }
	 */

	
	$(".close-window").click(function() { modalWindow.close(); });
	$(".modal-overlay").click(function() { modalWindow.close(); });
}
};

function closePopup() 
{
	//modal exists in an iframe, for flash to call this, it must 
	//refere to the parent to close the modal. Otherwise closing can
	//be done by applying the above style .close-window
		parent.modalWindow.close();
}

// Quick poll user actions section
$(document).ready(function () {
    $('#useractions a:contains("Submit vote")').attr('class', 'submitVote');
    $('#useractions a:contains("View results")').attr('class', 'viewResults');
    $('.submitVote').text('');
    $('.submitVote').append('<img src="/PublishingImages/poll_btn_viewResults-off.jpg" style="display:block;" class="rollover" alt="Click Here" />');
    $('.viewResults').hide();

    //Answer section
    if ($('#answers img[id$="imgResult"]').length) {
        $('#SPUserPollRegion').prepend('<div id="questionHeader">Here&#39;s how other people responded to the question.</div>');
        $('#question').css('color', '#007C99');
        $('.ms-WPHeader').css('background-image', 'url("/PublishingImages/poll_header_results.jpg")');
        $('#SPUserPollRegion').append('<div id="useractions" style="padding-left:6px"><a href="/pages/byetta_by_your_side.aspx"><img src="/PublishingImages/poll_btn_bbys-off.jpg" style="display:block;" class="rollover" alt="Click Here" /></a></div>');
    }

    $('.DiabetesQuickPoll').prependTo('#centerContent');
});


