﻿//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.$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">');
};
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;
}
