// JavaScript Document
var f_h,t_h,area_height,area_name,div_running,opened_area='';
//------------------------------------------

function goto2(uuu){
	var homestr = 'http://www.nordic.com.tw/';
	location.href = homestr + uuu;
}

function goto(url){
	location.href = url;
}

function gohome(){
	var homestr = 'http://';
	var funstr = 'www.nordic.com.tw/'
	location.href = homestr + funstr;
}

function gotoprod(showtype,id,prodid){
	var homestr = 'http://www.nordic.com.tw/';
	var funstr = 'store/main/prod/prod.asp?showtype='
	var funstr2 = '&id=';
	var funstr3 = '&prodid=';
	location.href = homestr + funstr + showtype + funstr2 + id + funstr3 + prodid;
}
function gotoprod2(prodid,catid,catsetid){
	var homestr = 'http://www.nordic.com.tw/';
	var funstr = 'store/main/prod/prod.asp?prodid='
	var funstr2 = '&catid=';
	var funstr3 = '&catsetid=';
	location.href = homestr + funstr + prodid + funstr2 + catid + funstr3 + catsetid;
}


function gotocat(cat,catset){
	var homestr = 'http://www.nordic.com.tw/';
	var funstr = 'store/main/prod/cat.asp?catid='
	var funstr2 = '&catset=';
	location.href = homestr + funstr + cat + funstr2 + catset;
}

function gotocat2(show,id){
	var homestr = 'http://www.nordic.com.tw/';
	var funstr = 'store/main/prod/cat2.asp?show='
	var funstr2 = '&id=';
	location.href = homestr + funstr + show + funstr2 + id;
}

function gotocatset(show,id){
	var homestr = 'http://www.nordic.com.tw/';
	var funstr = 'store/main/prod/catset.asp?show='
	var funstr2 = '&id=';
	location.href = homestr + funstr + show + funstr2 + id;
}


function gotoothers(fun){
	var homestr = 'http://www.nordic.com.tw/';
	var funstr = 'store/main/others/'
	var funstr2 = '.asp';
	location.href = homestr + funstr + fun + funstr2  ;
}

function gotogallery(id){
	var homestr = 'http://www.nordic.com.tw/';
	var funstr = 'store/main/others/'
	var funstr2 = 'gallery.asp?id=';
	location.href = homestr + funstr + funstr2 + id  ;
}

function gotoarticles(id,openid){
	var homestr = 'http://www.nordic.com.tw/';
	var funstr = 'store/main/others/'
	var funstr2 = 'articles.asp?id=';
	var funstr3 = '&open=';
	location.href = homestr + funstr + funstr2 + id + funstr3 + openid  ;
}


function gotoview2(str){
	var homestr = 'http://www.nordic.com.tw/';
	var funstr = 'store/main/others/'
	var funstr2 = 'view_2.asp?';
	location.href = homestr + funstr + funstr2 + str  ;
}


function poen_xx_area(area,h) {
if(div_running!=1){
	
  area_height=h;
  area_name=area;
  
	if(document.getElementById(area).style.display != "block"){
	    if(opened_area!=''){
	     document.getElementById(opened_area).style.display = "none";
  	     document.getElementById(opened_area).style.height = "0px";
	     document.getElementById(opened_area+"_bt").style.background = "url(http://www.nordic.com.tw/store/images/i2_r.gif) no-repeat 1px 2px"; 
         }
	  div_running=1;
      f_h=0;
      t_h=h;
      run_area = setInterval('run_xx_area()',10);
      document.getElementById(area).style.display = "block";
      document.getElementById(area+"_bt").style.background = "url(http://www.nordic.com.tw/store/images/i2_d.gif) no-repeat 0px 5px"; 

	}else{
      div_running=1;
      f_h=h;
      t_h=0;
      run_area = setInterval('run_xx_area()',10);
	}
}
}

//------------------------------------------
function poen_xx_area2(area,table) {
if(div_running!=1){
  h = document.getElementById(area).clientHeight;
  area_height=h;
  area_name=area;
  
	if(document.getElementById(area).style.display != "block"){
	    if(opened_area!=''){
	     document.getElementById(opened_area).style.display = "none";
  	     document.getElementById(opened_area).style.height = "0px";
	     document.getElementById(opened_area+"_bt").style.background = "url(http://www.nordic.com.tw/store/images/i2_r.gif) no-repeat 1px 2px";
         }
	  document.getElementById(area).style.display = "block";
	  h = document.getElementById(table).clientHeight ;
	  document.getElementById(area).style.display = "none";
      area_height=h;
      area_name=area;

	  div_running=1;
      f_h=0;
      t_h=h;
      run_area = setInterval('run_xx_area()',10);
      document.getElementById(area).style.display = "block";
      document.getElementById(area+"_bt").style.background = "url(http://www.nordic.com.tw/store/images/i2_d.gif) no-repeat 0px 5px"; 

	}else{
      div_running=1;
      f_h=h;
      t_h=0;
      run_area = setInterval('run_xx_area()',10);
	}
}
}
//------------------------------------------
function poen_xx_area3(area,table) {
if(div_running!=1){
  h = document.getElementById(area).clientHeight;
  area_height=h;
  area_name=area;
  
	if(document.getElementById(area).style.display != "block"){
	    if(opened_area!=''){
	     document.getElementById(opened_area).style.display = "none";
  	     document.getElementById(opened_area).style.height = "0px";
	     //document.getElementById(opened_area+"_bt").style.background = "url(http://www.nordic.com.tw/store/images/i2_r.gif) no-repeat 1px 2px";
         }
	  document.getElementById(area).style.display = "block";
	  h = document.getElementById(table).clientHeight ;
	  document.getElementById(area).style.display = "none";
      area_height=h;
      area_name=area;

	  div_running=1;
      f_h=0;
      t_h=h;
      run_area = setInterval('run_xx_area3()',10);
      document.getElementById(area).style.display = "block";
      //document.getElementById(area+"_bt").style.background = "url(http://www.nordic.com.tw/store/images/i2_d.gif) no-repeat 0px 5px"; 

	}else{
      div_running=1;
      f_h=h;
      t_h=0;
      run_area = setInterval('run_xx_area3()',10);
	}
}
}

//------------------------------------------
function Close_xx_area() {
if(div_running!=1){
	    if(opened_area!=''){
		 //alert(opened_area);
	     document.getElementById(opened_area).style.display = "none";
  	     document.getElementById(opened_area).style.height = "0px";
	     document.getElementById(opened_area+"_bt").style.background = "url(http://www.nordic.com.tw/store/images/i2_r.gif) no-repeat 1px 2px"; 
         }
	}
}
//--------------------------------------------
function run_xx_area() {
 f_h = f_h + (t_h-f_h)/3;
 yL = Math.round(f_h);		
 document.getElementById(area_name).style.height = yL+"px";	

  if(yL>(area_height-1)){
	clearTimeout(run_area);
	div_running=0;
	opened_area=area_name;
  }
  if(yL<1){
	clearTimeout(run_area);
	document.getElementById(area_name).style.display = "none";
	document.getElementById(area_name+"_bt").style.background = "url(http://www.nordic.com.tw/store/images/i2_r.gif) no-repeat 1px 2px"; 
	div_running=0;
	opened_area='';
  }	
}

//===========================================================================

function run_xx_area3() {
 f_h = f_h + (t_h-f_h)/3;
 yL = Math.round(f_h);		
 document.getElementById(area_name).style.height = yL+"px";	

  if(yL>(area_height-1)){
	clearTimeout(run_area);
	div_running=0;
	opened_area=area_name;
  }
  if(yL<1){
	clearTimeout(run_area);
	document.getElementById(area_name).style.display = "none";
	//document.getElementById(area_name+"_bt").style.background = "url(http://www.nordic.com.tw/store/images/i2_r.gif) no-repeat 1px 2px"; 
	div_running=0;
	opened_area='';
  }	
}

//===========================================================================



function Toggle(item) 
{ 
    if (item != '') {
		obj = document.getElementById(item); 
		if(document.getElementById(item)){
			visible = (obj.style.display != "none")
			key = document.getElementById("x" + item); 
			if ( visible ) 
			{ 
				obj.style.display = "none";		
				if(document.getElementById("x" + item))
					{
						key.style.background = "url(http://www.nordic.com.tw/store/images/i_r.gif) no-repeat 2px 4px"; 
					}
				//a = key.getElementsByTagName('a');
				//a[0].style.color="#808080";
			} 
			else 
			{ 
				obj.style.display = "block"; 
				if(document.getElementById("x" + item))
					{
						key.style.background = "url(http://www.nordic.com.tw/store/images/i_d.gif) no-repeat 0 5px"; 
					}
				//a = key.getElementsByTagName('a');
				//a[0].style.color="#000";
			}
		}
	}
} 

//---------------------------三角指標在右邊版本
function Toggle2(item) 
{ 
    if (item != '') {
		obj = document.getElementById(item); 
		if(document.getElementById(item)){
			visible = (obj.style.display != "none")
			key = document.getElementById("x" + item); 
			if ( visible ) 
			{ 
				obj.style.display = "none";		
				if(document.getElementById("x" + item))
					{
						key.style.background = "url(http://www.nordic.com.tw/store/images/i_r.gif) no-repeat right center"; 
					}
				//a = key.getElementsByTagName('a');
				//a[0].style.color="#808080";
			} 
			else 
			{ 
				obj.style.display = "block"; 
				if(document.getElementById("x" + item))
					{
						key.style.background = "url(http://www.nordic.com.tw/store/images/i_d.gif) no-repeat right center"; 
					}
				//a = key.getElementsByTagName('a');
				//a[0].style.color="#000";
			}
		}
	}
} 


//==========================================================================
function index_menu(){
var dmaLi = document.getElementById('index_menu_area');
var dmaLi_item = dmaLi.getElementsByTagName('li');
for(i=0; i<dmaLi_item.length ;i++){
  dmaLi_item[i].style.cursor="pointer";
  /*dmaLi_item[i].onmouseover=chbor2;
  dmaLi_item[i].onmouseout=chbor2;*/
}
}

function gallery_menu(){
var dmaDiv = document.getElementById('gallery_right_right');
var dmaDiv_item = dmaDiv.getElementsByTagName('div');
for(i=0; i<dmaDiv_item.length ;i++){
  dmaDiv_item[i].style.cursor="pointer";
  dmaDiv_item[i].onmouseover=chbor3;
  dmaDiv_item[i].onmouseout=chbor4;
}
}

//==========================================================================
  function chbor1(){
  this.style.border="1px solid #808080";
  }
  
  function chbor2(){
  this.style.border="1px solid #cecece";
  }
  
  function chbor3(){
  this.style.border="1px solid #666";
  }
  
  function chbor4(){
  this.style.border="1px solid #fff";
  }
  
  function gotourl(goto_url){
  location.href = goto_url;
  }
//==========================================================================
var gus_say_open=0;
function gus_say_area(x){ 
tit_1 = document.getElementById("good_title"); 
txt_1 = document.getElementById("gus_say_txt_1"); 
tit_2 = document.getElementById("gus_say_tit_2"); 
txt_2 = document.getElementById("gus_say_txt_2"); 
tit_3 = document.getElementById("gus_say_tit_3"); 
txt_3 = document.getElementById("gus_say_area_2"); 

if(x==1 && gus_say_open==0){
txt_1.style.display = "block"; 
tit_2.style.display = "block"; 
txt_2.style.display = "none"; 
tit_3.style.display = "block"; 
txt_3.style.display = "none"; 
gus_say_open=1;
}else if(x==2){
txt_1.style.display = "block"; 
tit_2.style.display = "none"; 
txt_2.style.display = "block"; 
tit_3.style.display = "block";	
txt_3.style.display = "none";
}else if(x==3){
txt_1.style.display = "none"; 
tit_2.style.display = "none"; 
txt_2.style.display = "none"; 
tit_3.style.display = "none";	
txt_3.style.display = "block";
}else{
txt_1.style.display = "none"; 
tit_2.style.display = "none"; 
txt_2.style.display = "none"; 
tit_3.style.display = "none";	
txt_3.style.display = "none"; 
gus_say_open=0;
}

if(gus_say_open==0){
tit_1.style.background ="#e6e7e8 url(http://www.nordic.com.tw/store/images/arrow_6.gif) no-repeat 13px 5px";
}else{
tit_1.style.background ="#e6e7e8 url(http://www.nordic.com.tw/store/images/arrow_7.gif) no-repeat 11px 8px";	
}


}

//==========================================================================
