function additionalResourceClick(section,URL)
{
    var url = URL;
    LinkClick(section);
    var w = screen.width;
    var h = screen.height;
    var features = "height=600,width=960,resizable=1,scrollbars=1";
    helpWindow = window.open(url, "_blank", features );    
}

function moreinfo()
{
    var url = "http://www.microsoft.com/dynamics/gp/product/productoverview.mspx";

    LinkClick(2);
    var w = screen.width;
    var h = screen.height;
    var features = "height=600,width=960,resizable=1,scrollbars=1";
    helpWindow = window.open(url, "_blank", features , "help");    
}

//used inline javascript instead
function openFeedback()
{
    if(FeedbackWindow == null || FeedbackWindow.closed)
    {
        var BType = GetBType();
        var w = 975;
	    var h = 600;
	    wleft = (screen.width - w) / 2;
        wtop = (screen.height - h - 30) / 2;
	    if (wleft < 0) wleft = 0;
	    if (wtop < 0) wtop = 0;
	    FeedbackWindow = window.open("feedback/eval.aspx", "FeedbackWindow", "height="+h+",width="+w+",left="+wleft+",top="+wtop+",scrollbars=yes,resizable=0");

		if (isunload==false && (FeedbackWindow==null || typeof(FeedbackWindow)=="undefined"))
		{
			alert("You have a pop-up blocker that blocked the feedback window from being opened.\rPlease configure your pop-up blocker to allow pop-ups from this site.");
		}
		else if (FeedbackWindow!=null && typeof(FeedbackWindow)!="undefined")
		{
		    document.cookie = "evalopen=1";
            FeedbackWindow.focus();
		}
	}
	else
	{
        FeedbackWindow.focus();
    }
}



function referafriend()
{
    LinkClick(3);
	var url = "mailto:?subject=Try%20the%20Microsoft%20Dynamics%20Test%20Drive&Body=Hello,%20I%20just%20got%20a%20firsthand%20tour%20of%20Microsoft%20Dynamics%20and%20thought%20it%20might%20be%20of%20interest%20to%20you.%20%20Microsoft%20Dynamics%20is%20a%20line%20of%20integrated,%20adaptable%20business%20management%20solutions%20that%20automate%20and%20streamline%20financial,%20customer%20relationship,%20and%20supply%20chain%20processes%20in%20a%20way%20that%20helps%20you%20drive%20business%20success.%20%20Through%20an%20online%20test-drive,%20you%20can%20try%20(or%20%22test-drive%22%20Microsoft%20Dynamics%20without%20having%20to%20install%20it%20on%20your%20PC.%20%20You%20can%20log%20onto%20the%20test-drive%20environment%20using%20your%20Web-browser%20and%20see%20how%20it%20works.";
	url += "%0D%0A%0D%0AClick%20http://www.dynamicstestdrive.com%20to%20begin%20your%20test-drive%20experience!%20";
    location.href=url;
}

function buynow()
{
    var url = "http://www.microsoft.com/dynamics/gp/purchase/default.mspx";
    LinkClick(4);
    var w = screen.width;
    var h = screen.height;
    var features = "height=600,width=960,resizable=1,scrollbars=1";
    
    window.open(url, "_blank", features , "buynow");
}

function tryIt(exercise)
{
    var console = "systemcheck.aspx?exercise="+exercise;

	if(WindowObjectReference == null || WindowObjectReference.closed)
	{
		var w = 1016;
		var h = 720;
		wleft = (screen.width - w) / 2;
		wtop = (screen.height - h - 95) / 2;
		if (wleft < 0) wleft = 0;
		if (wtop < 0) wtop = 0;
		WindowObjectReference = window.open(console, "vlabenhancedwindow", "height="+h+",width="+w+",left="+wleft+",top="+wtop+",scrollbars=yes,status=1,resizable=1",true);

		if (WindowObjectReference==null || typeof(WindowObjectReference)=="undefined") {
			alert("You have a pop-up blocker that blocked the console window from being opened.\rPlease configure your pop-up blocker to allow pop-ups from this site.");
		}
	}
	else
	{
		WindowObjectReference.focus();
    }
    location.href = 'TestDriveReturn.aspx';
	
}

var labID;

function getURLParameters() 
{
    var sURL = window.document.URL.toString();
	
    if (sURL.indexOf("?") > 0)
    {
        var arrParams = sURL.split("?");
			
        var arrURLParams = arrParams[1].split("&");
		
        var arrParamNames = new Array(arrURLParams.length);
        var arrParamValues = new Array(arrURLParams.length);
		
        var i = 0;
        for (i=0;i<arrURLParams.length;i++)
        {
	        var sParam =  arrURLParams[i].split("=");
	        arrParamNames[i] = sParam[0];
	        if (sParam[1] != "")
		        arrParamValues[i] = unescape(sParam[1]);
	        else
		        arrParamValues[i] = "No Value";
        }
		
        for (i=0;i<arrURLParams.length;i++)
        {
        }
    }
    else
    {
    }
    
    labID = arrParamValues[0];        
}
        
function playVid(sz)
{
    var vid = "videos/" + sz + ".asx";

    var d = document.getElementById("ctl00_ContentPlaceHolder1_vidhere");
    d.innerHTML = "<object id='VideoPlayer' width='642' height='526' classid='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' standby='Loading the video preview...' type='application/x-oleobject' VIEWASTEXT>" +
        "<PARAM NAME='FileName' VALUE='" + vid + "'>" +
        "<PARAM NAME='AnimationatStart' VALUE='1'>" +
        "<PARAM NAME='TransparentatStart' VALUE='1'>" +
        "<PARAM NAME='AutoStart' VALUE='1'>" +
        "<PARAM NAME='ShowControls' VALUE='1'>" +
        "<PARAM NAME='ShowDisplay' VALUE='0'>" +
        "<PARAM NAME='ShowStatusBar' VALUE='0'>" +
        "<PARAM NAME='AutoSize' VALUE='1'>" +
        "<PARAM NAME='InvokeUrls' VALUE='0'>" +
        "</object>";
    VideoPlayer = document.getElementById("VideoPlayer");
} 

function playFlash(fm)
{
    var vid = "videos/" + fm + ".swf";
    var d = document.getElementById("ctl00_ContentPlaceHolder1_vidhere");
    d.innerHTML = "<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width='620' height='484' ID='Captivate1'>" +
		"<param name='movie' value='" + vid + "'>" +
		"<param name='quality' value='high'>" +
		"<param name='loop' value='0'>" +
		"<embed src='" + vid + "' width='610' height='480' loop='0' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' menu='false'></embed>" +
	    "</object>";
}               

var WindowObjectReference;

function get_cookie(Name)
{
    var search = Name + "="
    var returnvalue = "";
    if (document.cookie.length > 0)
    {
        offset = document.cookie.indexOf(search)
        // if cookie exists
        if (offset != -1)
        { 
            offset += search.length
            // set index of beginning of value
            end = document.cookie.indexOf(";", offset);
            // set index of end of cookie value
            if (end == -1) end = document.cookie.length;
            returnvalue=unescape(document.cookie.substring(offset, end))
        }
    }
    return returnvalue;
}

function windowresize()
{
    var footer;
    var bgimage;
    var pagecheck = document.location.href.toLowerCase();
    if (pagecheck.indexOf("video.aspx")>=0)
    {
        footer = document.getElementById("ctl00_footerPanel");
        if (document.body.offsetHeight <= 680)
        {
            footer.style.bottom = 0;
            footer.style.top = 685;
        }
        else
        {
            footer.style.top = document.body.offsetHeight;
        }
    }
    else if (pagecheck.indexOf("flash.aspx")>=0)
    {
        footer = document.getElementById("ctl00_footerPanel");
        if (document.body.offsetHeight <= 660)
        {
            footer.style.bottom = 0;
            footer.style.top = 665;
        }
        else
        {
            footer.style.top = document.body.offsetHeight;
        }
    }
    else if(pagecheck.indexOf("console.aspx")>=0)
    {
		if(document.getElementById("ctl00_ctl00_footerPanel"))
		{
			footer = document.getElementById("ctl00_ctl00_footerPanel");
		}
		else if(document.getElementById("ctl00_footerPanel"))
		{
			footer = document.getElementById("ctl00_footerPanel");
		}
		 
		if (footer != null)
		{
            if (document.body.offsetHeight <= 763 )
            { 
                footer.style.bottom = null;
                footer.style.top = 763;
            }
            else
            {
                footer.style.bottom = 0;
                footer.style.top = null;
            }
        }
    }
    else if(pagecheck.indexOf("terms.aspx")>=0)
    {
		if(document.getElementById("ctl00_ctl00_footerPanel"))
		{
			footer = document.getElementById("ctl00_ctl00_footerPanel");
		}
		else if(document.getElementById("ctl00_footerPanel"))
		{
			footer = document.getElementById("ctl00_footerPanel");
		}
		 
		if (footer != null)
		{
            if (document.body.offsetHeight <= 1300 )
            { 
                footer.style.bottom = null;
                footer.style.top = 1263;
            }
            else
            {
                footer.style.bottom = 0;
                footer.style.top = null;
            }
        }
    }
    else if(pagecheck.indexOf("privacy.aspx")>=0)
    {
		if(document.getElementById("ctl00_ctl00_footerPanel"))
		{
			footer = document.getElementById("ctl00_ctl00_footerPanel");
		}
		else if(document.getElementById("ctl00_footerPanel"))
		{
			footer = document.getElementById("ctl00_footerPanel");
		}
		 
		if (footer != null)
		{
            if (document.body.offsetHeight <= 1300 )
            { 
                footer.style.bottom = null;
                footer.style.top = 1463;
            }
            else
            {
                footer.style.bottom = 0;
                footer.style.top = null;
            }
        }
    }
    
    else if(pagecheck.indexOf("eval.aspx")>=0)
    {
		if(document.getElementById("ctl00_ctl00_footerPanel"))
		{
			footer = document.getElementById("ctl00_ctl00_footerPanel");
		}
		else if(document.getElementById("ctl00_footerPanel"))
		{
			footer = document.getElementById("ctl00_footerPanel");
		}
		 
		if (footer != null)
		{
            if (document.body.offsetHeight <= 1450 )
            { 
                footer.style.bottom = null;
                footer.style.top = 1450;
            }
            else
            {
                footer.style.bottom = 0;
                footer.style.top = null;
            }
        }
    }
    
    else
    {
		if(document.getElementById("ctl00_ctl00_footerPanel"))
		{
			footer = document.getElementById("ctl00_ctl00_footerPanel");
		}
		else if(document.getElementById("ctl00_footerPanel"))
		{
			footer = document.getElementById("ctl00_footerPanel");
		}
		 
		if (footer != null)
		{
            if (document.body.offsetHeight <= 705)
            { 
                footer.style.bottom = 0;
                footer.style.top = 704;
            }
            else
            {
                footer.style.bottom = 0;
                footer.style.top = null;
            }
        }
    }
}

function TrackContentView(contentId) {
    $.post('TrackingHelper.ashx', { action: 'cv', targetId: contentId });
}
function TrackLinkClick(linkId) {
    $.post('TrackingHelper.ashx', { action: 'link', targetId: linkId });
}

