function goToURL(obj) {
    var i = obj.selectedIndex;
    if(i>0){
        if(obj.options[i].value.indexOf('http://')==-1)
            window.open('http://' + obj.options[i].value);
        else
            window.open(obj.options[i].value);
    }
}
function setCurrent(id){
    document.getElementById('mnu_' + id).className="current";
}
function get_active_menu(mnu_id_arr){
    var url=self.location.href.toLowerCase();
    var i=0;
    var n = mnu_id_arr.length;
    for(;i < n;i++){
        if(url.indexOf((MAKE_REAL_SEO_URL ? '/' : '?mod=' )+ mnu_id_arr[i])>-1){
            setCurrent( mnu_id_arr[i]);
            break;
        }
    }
    if(i == n){
        setCurrent('home');
    }
}
function checksearch()
{
    if(jQuery("#keyword").val()=="" || jQuery("#keyword").val()==searchStr)
    {
        alert(searchStr);
        jQuery("#keyword").focus();
        return false;
    }
    return true;
}
function doSearch()
{
    if(!checksearch())
        return;
    jQuery('#searchSubmit').val('OK');
    jQuery('#frmSearch').submit();
}
function addToCart(contentID){
    var url = self.location.href;
    var chi_so = url.indexOf('?');
    var contentUrl = '';
    if(chi_so > 0){
        contentUrl = url.substr(chi_so + 1, url.length - chi_so);
        contentUrl = contentUrl.replace('&', '|');
    }
    self.location.href= MOD_BASKET + (MAKE_REAL_SEO_URL ? ('add/'+contentID+'/'+contentUrl) : ('&action=add&item='+contentID+"&return="+contentUrl));
}
function doDelete(id){
    if(confirm(deleteConfirmMessage)){
        self.location.href = MOD_BASKET + (MAKE_REAL_SEO_URL ? 'remove/'+id : '&action=remove&item='+id)
    }
}
function gup(myUrl,name)
{
    name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+name+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec(myUrl);
    if( results == null )
        return "";
    else
        return results[1];
}
function doContinue(){
    var myReturn = gup(self.location.href,'return');
    if(myReturn != ''){
        myReturn = '?' + myReturn.replace('|', '&');
    }
    if(MAKE_REAL_SEO_URL){
        self.location.href = indexPathPrefix.substr(0, indexPathPrefix.length - 1) + SEO_URL_EXT;
    }else{
        self.location.href = indexPathPrefix + myReturn;
    }
}
function doClear(){
    if(confirm(deleteConfirmMessage)){
        self.location.href = MOD_BASKET + (MAKE_REAL_SEO_URL ? 'clear' : '&action=clear');
    }
}
function doCheckOut(){
    self.location.href = MAKE_REAL_SEO_URL ? (MOD_BILL.substr(0, MOD_BILL.length - 1) + SEO_URL_EXT) :  MOD_BILL;
}
function ShowGoldPrice(){
    var sHTML = '';
    sHTML = sHTML.concat('	<tr>');
    //sHTML = sHTML.concat('		<td></td>');
    sHTML = sHTML.concat('		<td>SBJ</td>');
    sHTML = sHTML.concat('		<td>').concat(vGoldSbjBuy).concat('</td>');
    sHTML = sHTML.concat('		<td>').concat(vGoldSbjSell).concat('</td>');
    //sHTML = sHTML.concat('	</tr><tr class="lineTr"><td colspan="4"></td></tr>');
    sHTML = sHTML.concat('	<tr>');
    //sHTML = sHTML.concat('		<td></td>');
    sHTML = sHTML.concat('		<td>SJC</td>');
    sHTML = sHTML.concat('		<td>').concat(vGoldSjcBuy).concat('</td>');
    sHTML = sHTML.concat('		<td>').concat(vGoldSjcSell).concat('</td>');
    sHTML = sHTML.concat('	</tr>');
    return sHTML;
//gmobj('eGold').innerHTML = sHTML;
}
function ShowForexRate(){
    sHTML = '';
    for(var i=0;i<vForexs.length;i++){
        sHTML = sHTML.concat('	<tr>');
        sHTML = sHTML.concat('		<td align="left">').concat(vForexs[i]).concat('</td>');
        sHTML = sHTML.concat('		<td align="right">').concat(vCosts[i]).concat('</td>');
        sHTML = sHTML.concat('	</tr>');
    /* if(i<vForexs.length-2){
            sHTML = sHTML.concat('	<tr class="lineTr">');
            sHTML = sHTML.concat('		<td colspan="2"></td>');
            sHTML = sHTML.concat('	</tr>');
        } */
    }
    return sHTML;
}
// Function WriteSwf
function WriteSwf(img,wsize,hsize){
    document.write("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+wsize+"\" height=\""+hsize+"\">");
    document.write("<param name=\"movie\" value=\""+img+"\">");
    document.write("<param name=\"quality\" value=\"high\">");
    document.write("<param name=wmode value=transparent>");
    document.write("<param name=\"menu\" value=\"false\">");
    document.write("<embed src=\""+img+"\" wmode=\"transparent\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+wsize+"\" height=\""+hsize+"\" menu=\"false\"></embed>");
    document.write("</object>");
}
