//grobal variable
var uri=''; /*O_o*/
var url='';
url=document.location.href;

var query_string='';
var json='';
if (document.location.href!=null){
  url=document.location.href;
  if (url.indexOf('?')>0 && url.lastIndexOf('?')<url.length-1){//有?但不可以在第一個跟最後一個
    query_string=url.substring(url.indexOf('?')+1);
    var array=query_string.split('&');
    for (i=0;i<array.length;i++){
      if (array[i].indexOf('=')>0){
        array[i]=array[i].replace('.','');
        json+=((json=='')?'':',')+array[i].substring(0,array[i].indexOf('='))+':\''+array[i].substring(array[i].indexOf('=')+1)+'\'';
      }
    }//end for
  }//end if
}//end if
json='var r={'+json+'};';
eval(json);

/*------------------------------------------------------------------------------------------------*/
//object
var Nineder=window.NINEDER || {}; //v20070525 editor: burgess

Nineder.$W=function(o){
  document.writeln(o);
};

Nineder.$R=function(o){
  var re="";
  if (r[o]!=null){
    re=r[o];
  }
  return re;
};

Nineder.$URL=function(){
  return url;
};

Nineder.$URI=function(){
  return uri;
};


Nineder.$QueryString=function(){
  return query_string;
};

Nineder.$ShopId=function(){
  return document.location.href.substring(document.location.href.indexOf('//')+2,document.location.href.indexOf("."));
};

/*Nineder.$Style=function(o){ 
  var cs={
    SC20051001000001:'style1'
  };
  return cs[o]||'style1';
};*/

//Nineder.RootId='SC20051001000001'; 

Nineder.$LinkScript=function(o){
  Nineder.$W('<script src="'+Nineder.$URI()+'\/script\/'+o+'"><\/script>');
};

Nineder.$LinkCSS=function(o){
  Nineder.$W('<link href="'+Nineder.$URI()+'\/css\/'+o+'" rel="stylesheet" type="text\/css">');
};

//要改成java
/*Nineder.$FixText=function(o,len,postfix) {
  o = Nineder.$RemoveHtmlTag(o);
  var templen=0;
  var tempstr='';
  for(var i=0; i<o.length; i++) {
    var c = o.charAt(i);
    if(Nineder.$IsBig5Char(c)){
      templen+=1;
    }else{
      templen+=2;
    }
    tempstr+=o.substring(i,i+1);
    if(templen >= len){
      tempstr+='...'+postfix;
      break;
    }
  }//end for
  return tempstr;
}*/

//要改成java
/*Nineder.$IsBig5Char=function(o) {
  if(o.length > 1){
    return false;
  }else if(o==''){
    return true;
  }else{
    if (/^([\uFF66-\uFF9F]|[\u0000-\u00FF])*$/gi.test(o)){ return true; } else { return false; }
  }//end if
}*/


Nineder.$ReplaceAll=function(o,find,replace){
  var index=0;
  while(o.indexOf(find,index) != -1){
    o = o.replace(find,replace);
    index += find.length;
  }
  return o;
}

//要寫成java
/*Nineder.$RemoveHtmlTag=function(o){
  var tagPattern = /<{1}[^>]{1,}>{1}/i;
  while (o.match(tagPattern)!=null){
    o = o.replace(tagPattern,'');
  }
  return o;
}*/

//Nineder.PageSize=16;

//Nineder.Shift=3;

/*Nineder.$ThisPage=function(){
  var re=1;
  if (Nineder.$R('page')!=''){
    re=Nineder.$R('page');
  }
  return re;
};*/

/*------------------------------------------------------------------------------------------------*/
/*
var category_this='SC20051001000001';
var category_id1=Nineder.$R('category_id1');
var category_id2=Nineder.$R('category_id2');
var category_cname1='';
var category_cname2='';
if (category_id1!=''){
  category_this=category_id1;
}
if (category_id2!=''){
  category_this=category_id2;
}
var category_link=Nineder.$URI()+'/shop_category.jsp?category_id1='+category_id1+'&category_id2='+category_id2;
*/

/*------------------------------------------------------------------------------------------------*/

/*
Nineder.$LinkScript('category/'+Nineder.RootId+'.js');
Nineder.$LinkScript('category/'+category_this+'_product.js');
*/


