function newBrowser()
{
        var verVar = navigator.appVersion.charAt(0);
        return (parseInt(verVar) > 2) ? true: false
}

function loadSession(page)
{
        var winSize;
        if (newBrowser() == true)
        {
                winSize = "scrollbars=no,status=yes,width=495,height=380"
        }
        else
        {
                winSize = "menubar=no,scrollbars=no,status=yes,width=495,height=380"
        }
        msg = open(page,"Session",winSize);
}

function gotoTray(obj)
{
        var si = obj.form.trays.selectedIndex;
        
        var tray = obj.form.trays.options[si].value;
        
        

        if (tray != '')
        {
        //      alert('Go to ' + tray)
                document.location = 'http://www.hot-replica.com/pages/tray'+tray+'.htm';
                //document.location = '/cgi-bin/version2/show_tray.pl?tray=' + tray;
        }
        else
        {
                alert('Choose!');
        }
}

function setTray(obj)
{
        obj.form.tray.value = obj.value;
}

function gotoBespoke(obj)
{
        var si = obj.form.bespoke.selectedIndex;
        
        var bespoke = obj.form.bespoke.options[si].value;
        
        if (bespoke != '')
        {
//              alert('Go to ' + tray)
                document.location = 'http://www.hot-replica.com/pages/' + bespoke;
        }
        else
        {
                alert('Choose!');
        }
}

function setBespoke(obj)
{
        obj.form.bespoke.value = obj.value;
}

function getCurrency()
{
        //var si = document.TrayForm.currencytype.selectedIndex;
        //return document.TrayForm.currencytype.options[si].value;
        return 'USD';
}

function getRate(cur)
{
        
	if ( eval('typeof(rate_'+cur+')') == "undefined" )
        {
                rate = 1.0;
        }
        else
        {
                rate = eval('rate_'+cur);
        }
       
    	
        return rate;
}

function getSymbol(cur)
{
        switch (cur)
        {
                case "GBP" : return "&pound;";
                case "USD" : return "$";
                case "YEN" : return "&yen;";
                case "EUR" : return "&euro;";
                case "CAN"  : return "<strong><small>Can$&nbsp;</small></strong>";
                case "AUS"  : return "<strong><small>Aus$&nbsp;</small></strong>";
                default : return "[currency="+cur+"]";
        } 
}

function formatMoney(amount)
{
//      return String(Math.round(amount*100));

        value = String(Math.round(amount*100)/100);

        if( (""+value).indexOf(".") == -1 ){
        
                
				if(getSymbol(cur)=='&yen;')
					value = value;
				else
					value = value + ".00" ;
				
				
			   
        }else
        if( (value.toString().indexOf(".")!=-1) && ((value * 10).toString().indexOf(".")==-1) ){
        
                value = value + "0";
        }

        return value;
}

function showOption(option_label, option_price, shop_option_price)
{
        cur=getCurrency();
        rate=getRate(cur);
        symbol=getSymbol(cur);
        option_price1 = formatMoney(rate * option_price);
        shop_option_price1 = formatMoney(rate * shop_option_price);


        if (option_price!=0)
        {
          //show 2 prices
        	////return 	'<tr><th align=left nowrap><font size=-1 face=arial color=#FFFFFF>'+option_label+'&nbsp;</font></td><th align=right><font size=-1  face=arial>'+symbol+option_price1+'</font></th>
          	//		<th align=right><strike><font size=3 face=arial><sup>' + shop_option_price1 + '</sup></font></strike></th></tr>';
          			
        //show 1 price
        if(option_label)//if option label exist
        	return 	'<tr><th align=left nowrap ><font size=-1 face=arial color=#FFFFFF>' + option_label + '&nbsp;</font></td><th align=right><font size=-1  face=arial>'+symbol+option_price1+'</font></th></tr>'; 
        else
        	return 	'<tr><th align=center colspan=2 ><font size=-1  face=arial>'+symbol+option_price1+'</font></th></tr>'; 
        }
        else 
                return '';

}

function showItem(item_price , shop_item_price)
{
        if( item_price1 != "0.00")
        {
                return showOption("", item_price , shop_item_price);
        }else {
                return '<tr><th align=left nowrap><font size=-1 face=arial color=black><u><strong>SOLD OUT</strong></u></font></th></tr>';
        }

}

prices_shown=false;

function showPrices( prices )
{
        if (eval('typeof ('+prices+')')=='string')
        {

                prices_string = eval( prices ) ;
                prices_array = prices_string.split('|');
                var w = 120;
                var all_options="";
                for ( i=0; i<10 ; i++ )
                {
                        all_options = all_options + showOption("Option"+(i+1), 
                                                        prices_array[i],
                                                        prices_array[i+10]
                                                        );
                }
                
                var first_option=showOption("Option1", prices_array[0] , prices_array[10] );
                if (all_options == first_option)
                 {
                       all_options= showOption("", prices_array[0] , prices_array[10] );
                        
                        w=70;
                }
				
               
                if(all_options)
                {
                 	all_options = '<tr width=20%><th align=center><NOBR><font size=+1 face=verdana,arial nowrap color=#FFFFFF> Price</font><NOBR></th></tr>' + all_options + '<tr><th nowrap colspan=4 align=center><font size=-8 face=tahoma color=#FFFFFF>Click for details</font> </th></tr>';       
                     //  all_options = '<tr width=20%><th width=20% nowrap>&nbsp;</th><th width=35% align=left><NOBR><font size=-4 face=verdana,arial nowrap color=#FFFFFF> Our price</font><NOBR></th></tr>' + all_options+'<tr><th nowrap colspan=3><font size=-2 face=arial color=#FFFFFF>Click for more details</font> </th></tr>';
                }else
                {

                        all_options = '<tr><th align=left nowrap><font size=-1 face=arial color=black><u><strong>Sorry, this item sold out</strong></u></font></th></tr>';
                }
                
                prices_shown=true;
                return overlib(all_options, BACKGROUND, '', FGCOLOR, '#686C6F', BGCOLOR, '#c0c0c0', BORDER, 1, WIDTH, w);
        }
}

function hidePrices()
{
        if (prices_shown)
        {
                nd();
        }
        prices_shown=false;
}

function ShowLoginInfo()
{
        if (typeof(loged_in_as)=='string') {
                document.write(loged_in_as);
        }
}

// item

function tell_a_friend(option_desc)
{
        who=("","");
  if (who != null)
  {
                what = ("Replica watch price");
    message=("Please have look at replica watch at http://www.hot-replica.com/cgi-bin/version2/show_item.pl?item=60.01  ("+option_desc+")");
    if (what != null)
    {
        parent.location.href='mailto:'+who+'?subject=' + escape(what) + '&body=' + escape(message);
    }
  }
}
//new sendmessage
function tell_a_friend_about(item , option_desc)
{
        who=("","");
  if (who != null)
  {
                what = ("Replica watch price");
    message=("Please have look at replica watch at http://www.hot-replica.com/show_item.php?item="+item+"  ("+option_desc+")");
    if (what != null)
    {
        parent.location.href='mailto: ?subject=' + escape(what) + '&body=' + escape(message);
    }
  }
}



function add_to_basket(item, price)
{
        document.itemform.item.value = item;
        document.itemform.cost.value = price;
        document.itemform.submit();
}


function alert_msg(){
                
        alert("Can't change this!");
}


//alert('1');

