﻿    // Handle index rollover

    $(document).ready(function() {
	    $(".ro").hover(
		    function()
			{
			    this.src = this.src.replace("navigation","navigation-rollover");
			},
			function()
			{
			    this.src = this.src.replace("navigation-rollover","navigation");			 }
			);
		});
            
			
			
			
			// Copyright information must stay intact
			// WinOpen v1.0
			// Copyright NavSurf.com 2002, all rights reserved
			// For more scripts, visit NavSurf.com at http://navsurf.com
			 
			// Set the input argument to true to enable the window feature
			//         winOpen('http://twitter.com/IDCG_Clearing','IDCG - Twitter',595,400,true,false,false,true,true,true);"
			function winOpen(URL, windowName, width, height, resizable, location, menubar, scrollbars, status, toolbar){
				var windowFeatures;
				windowFeatures = '';
				if (width != '' && width != null){
					windowFeatures = windowFeatures+'width='+width+',';
				}
				if (height != '' && height != null){
					windowFeatures = windowFeatures+'height='+height+',';
				}
				if (resizable){
					windowFeatures = windowFeatures+'resizable=1,';
				}
				if (location){
					windowFeatures = windowFeatures+'location=1,';
				}
				if (menubar){
					windowFeatures = windowFeatures+'menubar=1,';
				}
				if (scrollbars){
					windowFeatures = windowFeatures+'scrollbars=1,';
				}
				if (status){
					windowFeatures = windowFeatures+'status=1,';
				}
				if (toolbar){
					windowFeatures = windowFeatures+'toolbar=1';
				}
				window.open(URL, windowName, windowFeatures);
			}




var launch = false; 

function TestBrowser()
{
alert(jQuery.browser);
}

 function ConfirmAged_SubmitJS()
{   
    //alert("ConfirmAged_SubmitJS");
    var cb_ = $("input[name='ctl00$ContentPlaceHolder2$IsAgedContract']");
    //alert("Confirmed - gah" + cb_.attr('checked'));
    cb_.attr('checked', true);
}
function CancelAged_SubmitJS()
{   //alert("CancelAged_SubmitJS");
    var cb_ = $("input[name='ctl00$ContentPlaceHolder2$IsAgedContract']");
    //alert("Cancelled - gah" + cb_.attr('checked'));
    cb_.attr('checked', false);
}

function ShowPopupIsAged()
{   
    //alert("?");
    var modal = $find('ctl00_ContentPlaceHolder2_IsAgedContract_Extender'); 
    modal.show(); 
}

function ShowMyModalPopup()
{ 
//alert("1");
//Run a validation

var errormessage = false;
var strerro = "";
// Check to see if the participants are the same:
    if ($("select[name='ctl00$ContentPlaceHolder2$buyParticipant']").val() == $("select[name='ctl00$ContentPlaceHolder2$sellParticipant']").val())
    {
        if ($("select[name='ctl00$ContentPlaceHolder2$buyUser']").val() == $("select[name='ctl00$ContentPlaceHolder2$sellUser']").val())
        {
            errormessage = true;
            strerror = "The Participant cannot trade with themselves, please select a different Participant.";
        }
    }

if ($("input[name='ctl00$ContentPlaceHolder2$calcNotional']").getValue() != "" 
    & $("input[name='ctl00$ContentPlaceHolder2$calcNotional']").getValue() != "0"
    & $("input[name='ctl00$ContentPlaceHolder2$Price']").getValue() != "0"
    & $("input[name='ctl00$ContentPlaceHolder2$Price']").getValue() != ""
    )
{

 var textmessage = $("select[name='ctl00$ContentPlaceHolder2$buyParticipant'] option:selected").text() 
                + " pays a fixed rate of " + $("input[name='ctl00$ContentPlaceHolder2$Price']").getValue() 
                + " to "
                + $("select[name='ctl00$ContentPlaceHolder2$sellParticipant'] option:selected").text() 
                + " through " 
                + $("td#EndDate:first").text() + " on a notional of "
                + $("td#Currency:first").text() + " " + $("input[name='ctl00$ContentPlaceHolder2$calcNotional']").getValue() 
                + " against " 
                + $("td#Index").text() + ".";
 var legalmsg = $("input[name='ctl00$ContentPlaceHolder2$LegalDisclaimer']").getValue();
 
 $("p#TradeDefinition").html(textmessage); //.getElementById('ctl00$ContentPlaceHolder2$TradeDefinition'); 
 $("p#LegalMessage").html(legalmsg); //.getElementById('ctl00$ContentPlaceHolder2$TradeDefinition'); 
 
 
} else {
    errormessage = true;
    strerror = "Please ensure fields are populated correctly:\n Notional and Rate must be greater than 0.";
}

if (errormessage)
{
    $("p#errormessage_external").html(strerror);
    var modal = $find('ctl00_ContentPlaceHolder2_ErrorMsgExtender'); 
    modal.show(); 
    
} else {
    var modal = $find('ctl00_ContentPlaceHolder2_Submit_Extender'); 
    modal.show(); 
}

}




function validateTicket()
{ 
//Run a validation
var errormessage = false;
var strerro = "";
// Check to see if the participants are the same:
    
if ($("input[name='ctl00$ContentPlaceHolder2$calcNotional']").getValue() == "" 
    || $("input[name='ctl00$ContentPlaceHolder2$calcNotional']").getValue() == "0"
    || $("input[name='ctl00$ContentPlaceHolder2$Price']").getValue() == "0"
    || $("input[name='ctl00$ContentPlaceHolder2$Price']").getValue() == ""
    )
{
    errormessage = true;
    strerror = "Please ensure fields are populated correctly:\n Notional and Rate must be greater than 0.";
}

if (errormessage)
{
    $("p#errormessage_external").html(strerror);
    var modal = $find('ctl00_ContentPlaceHolder2_ErrorMsgExtender'); 
    modal.show();
     
    return false;
} else {

   return true;
}

}



function validateAged()
{ 
//Run a validation
var errormessage = false;
var strerro = "";
// Check to see if the aged portion is ok:
if ($("input[name='ctl00$ContentPlaceHolder2$aged']:checked").getValue() == "" 
    )
{
    errormessage = true;
    strerror = "Please check either YES or NO as part of the Aged Contract Check";
    $("#agedcheck").addClass("highlight");
}

if (errormessage)
{
    $("p#errormessage_external").html(strerror);
    var modal = $find('ctl00_ContentPlaceHolder2_ErrorMsgAged'); 
    modal.show();
    return false;
} else {
   return true;
}

}








