﻿// JScript File
function GetStateCountryValue(countryId,stateId,sType){
    event.returnValue=false;
    event.cancel=true;
    var cntCountry=document.getElementById(countryId);
    var cntState=document.getElementById(stateId);
    var rtnVal=window.showModalDialog("../WebComponent/StateCountry.htm",sType+","+ GetFullCountryName(cntCountry.value),"left=200,top=200,width=400,height=200,scrollbar=1,toolbar=1,status=1,");   
    if(rtnVal!=null){
        if(sType=='S'){
            cntState.value=rtnVal.split(",")[0];
            cntCountry.value=GetSmallCountryName(rtnVal.split(",")[1]);
            }
        else if(sType=='C'){
            cntState.value='';
            cntCountry.value=GetSmallCountryName(rtnVal.split(",")[1]);
        }
    }
}

function GetStateValue(countryName, stateId){
    event.returnValue=false;
    event.cancel=true;
    var cntState=document.getElementById(stateId);
    var rtnVal=window.showModalDialog("../WebComponent/StateCountry.htm",'S'+","+ GetFullCountryName(countryName),"left=200,top=200,width=400,height=200,scrollbar=1,toolbar=1,status=1,");   
    if(rtnVal!=null){
         cntState.value=rtnVal.split(",")[0];
    }
}

function GetSmallCountryName(sCountry)
{
    if (sCountry=="USA"){
        return "US"
    }
    else if(sCountry=="CAN"){
        return "CN"
    }
    else if(sCountry=="MEX"){
        return "MX"
    }
    else
    {
        return sCountry;
    }
    
}

function GetFullCountryName(sCountry)
{
    if (sCountry=="US"){
        return "USA"
    }
    else if(sCountry=="CN"){
        return "CAN"
    }
    else if(sCountry=="MX"){
        return "MEX"
    }
    else
    {
        return sCountry;
    }
    
}

function ChatCS(){
    window.open('http://chat.transfunds.com/chat/tfportal.htm', '_blank','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no,resizable=no, copyhistory=no, width=500, height=500');
    event.returnValue=false;
    event.cancel=true;            
}
function showContact(){
    //window.open("../secure/Contactus.aspx","_blank",'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes,resizable=no, copyhistory=no, width=500, height=500');
    window.open("../secure/Contactus.aspx", "_blank", 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes,resizable=yes, copyhistory=no,');
    event.returnValue=false;
    event.cancel=true;
}

//Specific to ICIGAS only

//function showICIGASContact() {
//    window.open("../Secure/Contactus.aspx");
//    event.returnValue = false;
//    event.cancel = true;
//}

///////////////////
function printDocument(){
//    var url =  window.location.href;
//    var arr = url.split("?");    
//    if (arr.length > 1)
//    {
//        url = url + "&Print=Y";
//    }
//    else
//    {
//        url = url + "?Print=Y";
//    }
//    window.open("../Print/Print.aspx",'_blank', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes,resizable=no, copyhistory=no, width=800, height=600');
    window.open("../Help/Print.aspx",'_blank'); 
    event.returnValue=false;
    event.cancel=true;
    event.cancelBubble=true;
}

function showHelp(){
    window.open("../Help/Help.aspx","_blank",'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes,resizable=no, copyhistory=no, width=500, height=500');
    event.returnValue=false;
    event.cancel=true;
}