﻿function ShowShipping()
{
    //alert(Country);
    var html = '';
    if (COUNTRY.toUpperCase() == "UNITED STATES")
    {
        html += '    <div id="divShippingUS" style="padding: 10 0 0 10; width:300px">';
        html += '        <table>';
        html += '            <tr>';
        html += '                <td>';
        html += '                    <table>';
        html += '                        <tr valign="top">';
        html += '                            <td style="color:#5d235f; padding:0 5px 0 0" width="100px">Zip Code: </td>';
        html += '                            <td width="70px"><input type="text" id="tbShippingZipCode" style="color:Black;width:50px;" /></td>';
        html += '                            <td style="color:#333333"><img src="images/buttons/calcShipping.jpg" onmouseover="SwapImage(this)" onmouseOut="RestoreImage(this)" onclick="CalculateShippingUS()" /></td>';
        html += '                            <td style="color:#FF7F00; font-weight:bold; font-size:14px; padding:0 0 0 40px;" align="right"><img src="images/ups_icon2.jpg" /></td>';        
        html += '                        </tr>';
        html += '                        <tr>';
        html += '                            <td style="color:red; padding:0 0 0 5" colspan="4"><span id="spnZipCodeMessage" /></td>';
        html += '                        </tr>';
        html += '                    </table>';               
        html += '                </td>';
        html += '            </tr>';
        html += '            <tr><td><div id="divShippingUSResults" style="color:#5d235f; padding:0 0 40 0">&nbsp;</div></td></tr>';
        html += '            <tr><td style="color:#515151; padding:5 25 0 0; ><div style="color:#717171"></div></td></tr>';
        html += '        </table>';
        html += '    </div>';
    }
    else if (COUNTRY.toUpperCase() == "CANADA")
    {
        html += '    <div id="divShippingInernational" style="padding: 20 0 0 10; width:300px">';
        html += '        <div align="left">';
        html += '            <table>';
        html += '            <tr>';
        html += '            <td width="300px"><img src="Images/Flags/'+COUNTRY.replace(' ','_').replace(' ','_')+'.gif" /><br /><br /></td>';
        html += '            </tr>';
        html += '            <tr>';
        html += '            <td style="color:#5d235f; font-size:14px; width:300px; height:60px" nowrap="nowrap">Shipping to Canada is usually between $15 - $25<div id="divShippingCost"></div></td>';
        html += '            </tr>';
        html += '            </table>';
        html += '        </div>';
        html += '    </div>';    
    }
    else
    {
        html += '    <div id="divShippingInernational" style="padding: 20 0 0 10; width:300px">';
        html += '        <div align="left">';
        html += '            <table>';
        html += '            <tr>';
        html += '            <td width="150px"><img src="Images/Flags/'+COUNTRY.replace(' ','_').replace(' ','_')+'.gif" /></td>';
        html += '            <td width="150px"><img src="images/buttons/calcShipping.jpg" onmouseover="SwapImage(this)" onmouseOut="RestoreImage(this)" onclick="CalcShipping()" /></td>';
        html += '            </tr>';
        html += '            <tr>';
        html += '            <td colspan="2" style="color:#5d235f; font-size:14px; width:300px; height:60px" nowrap="nowrap"><br /><br /><div id="divShippingCost"></div></td>';
        html += '            </tr>';
        html += '            </table>';
        html += '        </div>';
        html += '    </div>';
    }
    document.getElementById('divShippingContent').innerHTML = html;
}    
GetCountry();

function CalcShipping()
{
    if ((COUNTRY == 'UNITED STATES') || (COUNTRY == 'CANADA')) return;
    var d2 = new Date();  
    var _idn = ''; 
    if (location.href.match('localhost'))
        _idn = d2.getTime(); 
    AjaxCallType = 'calcshipping';
	//GetSearchResults('misc/Recieve.aspx', '?func=calcshipping&d=' + _idn);
	//alert('ss');
	
    var queryString = '';
    queryString += '?func=calcshipping';
    queryString += '&d=' + document.getElementById('ctl00_ContentPlaceHolder1_hdnD').value;
    queryString += '&w=' + document.getElementById('ctl00_ContentPlaceHolder1_hdnW').value;
    queryString += '&c=' + COUNTRY;
    queryString += '&a=' + document.getElementById('ctl00_ContentPlaceHolder1_hdnPrice').value;
    //alert(queryString);
    GetSearchResults('misc/Recieve.aspx', queryString); 
}

