/* Flash Embeded ***************************************** */
function Flash(url, width, height, wmode) {
  wmode = (wmode) ? wmode : "transparent";

  var buffer;

  buffer =  "<object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" ";
  buffer += "codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" ";
  buffer += "width=" + width + " "; 
  buffer += "height=" + height + ">";
  buffer += "<param name=\"wmode\" value=" + wmode + " />";
  buffer += "<param name=\"movie\" value=" + url + " />";
  buffer += "<param name=\"quality\" value=\"high\" />";
  buffer += "<embed src=" + url + " ";
  buffer += "quality=\"high\" ";
  buffer += "wmode=" + wmode + " ";
  buffer += "type=\"application/x-shockwave-flash\" ";
  buffer += "pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?p1_prod_version=shockwaveflash\" ";
  buffer += "width=" + width + " ";
  buffer += "height=" + height + ">";
  buffer += "</embed></object>";

  document.write(buffer);
}

/*ÇÃ·¡½Ã*/
function Sub_Flash(c,d,e,n) {
	var flash_tag = "";
	flash_tag = '<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	flash_tag +='codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" ';
	flash_tag +='WIDTH="'+c+'" HEIGHT="'+d+'" style="z-index:100">';
	flash_tag +='<param name="wmode" value="transparent">'; 
	flash_tag +='<param name="movie" value="'+e+'?pageNum='+n+'">';
	flash_tag +='<param name="quality" value="high">';
	flash_tag +='<embed src="'+e+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" ';
	flash_tag +='type="application/x-shockwave-flash"  WIDTH="'+c+'" HEIGHT="'+d+'"></embed></object>';
	document.write(flash_tag);
}


/* Flash Url ***************************************** */
function Menu(menuNum) {
  switch(menuNum) {
    case '1000':
      window.location.href = "/EN/komma/"
      break;10
    case '1010':
      window.location.href = "/EN/komma/introduction/introduction.asp"
      break;
    case '1020':
      window.location.href = "/EN/komma/history/history.asp"
      break;
    case '1030':
      window.location.href = "/EN/komma/organization/organization.asp"
      break;
    case '1040':
      window.location.href = "/EN/komma/location/location.asp"
      break;
    case '1050':
      window.location.href = "/EN/komma/notice/list.asp"
      break;
    case '2000':
      window.location.href = "/EN/statistic/"
      break;
    case '2010':
      window.location.href = "/EN/statistic/state/"
      break;
	  case '2011':
      window.location.href = "/EN/statistic/state/product.asp"
      break;
	  case '2012':
      window.location.href = "/EN/statistic/state/export.asp"
      break;
	  case '2013':
      window.location.href = "/EN/statistic/state/phase.asp"
      break;
    case '2020':
      window.location.href = "/EN/statistic/overseas/"
      break;
	  case '2021':
      window.location.href = "/EN/statistic/overseas/product.asp"
      break;
	  case '2022':
      window.location.href = "/EN/statistic/overseas/export.asp"
      break;
	  case '2023':
      window.location.href = "/EN/statistic/overseas/country.asp"
      break;
	  case '2024':
      window.location.href = "/EN/statistic/overseas/ranking.asp"
      break;	
    case '2030':
      window.location.href = "/EN/statistic/internal/"
      break;
	  case '2031':
      window.location.href = "/EN/statistic/internal/order/summary.asp"
      break;
	  case '2032':
      window.location.href = "/EN/statistic/internal/product/summary.asp"
      break;
	  case '2033':
      window.location.href = "/EN/statistic/internal/export/country.asp"
      break;
	  case '2034':
      window.location.href = "/EN/statistic/internal/import/country.asp"
      break;
    case '2040':
      window.location.href = "/EN/statistic/hscode/"
      break;  
    case '3000':
      window.location.href = "/EN/member/"
      break;
    case '3010':
      window.location.href = "/EN/member/member/search/"
      break;
    case '4000':
      window.open("http://exhibit.komma.org/");
      break;
    case '5000':
      window.open("http://www.simtos.org/");
      break;
    case '6000':
      window.location.href = "/EN/customer/"
      break;
    case '6010':
      window.location.href = "/EN/customer/qna/"
      break;
  }
}


/* Quick Launcher ***************************************** */
function Quick(menuNum) {
  switch(menuNum) {
    case '100': // HOME
      window.location.href = "/EN/main/"
      break;
    case '200': // KMTI
      window.open("/EN/komma/download/KMTI2008-2009(0814).pdf");
      break;
    case '300': // È¸¿ø»ç °Ë»ö
      window.location.href = "/EN/member/member/search/list.asp"
      break;
    case '400': // Cyber Exhibition
      window.open("http://exhibit.komma.org/");
      break;
    case '500': // SIMTOS
      window.open("http://www.simtos.org/");
      break;
    case '600': // ¿À½Ã´Â ±æ
      window.location.href = "/EN/komma/location/location.asp"
      break;
    case '900': //
      window.location.href = "/EN/"
      break;
  }
}


/* Quick Launcher Scroll ***************************************** */
function check_scrollmove() {
  var scroll_pixel, div_pixel, gtpos, gbpos, loop, moving_spd;
  var top_margin = 0;     // Ã¢ÀÇ ¸ÇÀ§¿ÍÀÇ ¿©¹é ³»·Á¿Ã¶§
  var top_margin2 = 0;    // Ã¢ÀÇ ¸ÇÀ§¿ÍÀÇ ¿©¹é ¿Ã¶ó¿Ã¶§
  var speed = 20;           // Á¡Â÷ ÁÙ¾îµå´Â ¼Óµµ¸¦ À§ÇÑ ¼³Á¤
  var speed2 = 15;          // setTimeoutÀ» À§ÇÑ ¼Óµµ ¼³Á¤

  scroll_pixel = document.body.scrollTop;
  gtpos = document.body.scrollTop+top_margin;
  gbpos = document.body.scrollTop+top_margin2;
  
  if(quickMenu.style.pixelTop < gtpos) {
    moving_spd = (gbpos-quickMenu.style.pixelTop)/speed;
    quickMenu.style.pixelTop += moving_spd;
  }
  if(quickMenu.style.pixelTop > gtpos) {
    moving_spd = (quickMenu.style.pixelTop-gtpos)/speed;
    quickMenu.style.pixelTop -= moving_spd;
  }
  loop = setTimeout("check_scrollmove()",speed2);
}

function moving_control() {
  var moving_stat = 1;      // ¸Þ´ºÀÇ ½ºÅ©·ÑÀ» ·Îµù½Ã on/off¼³Á¤ (1=¿òÁ÷ÀÓ, 0=¸ØÃã)
  
  if(!moving_stat) {
    check_scrollmove(); moving_stat = 1;
  }else {
    clearTimeout(loop); moving_stat = 0; quickMenu.style.pixelTop = top_margin;
  }
}


/* Go Related Links ***************************************** */
function GoRelatedLinks(link) {
  switch(link) {
    case '100': // home
      window.open("http://eng.kitech.re.kr/");
      break;  
    case '200': // home
      window.open("http://ksmte.web.riss4u.net");
      break;  
    case '300': // home
      window.open("http://www.kama.or.kr/eng/K_eng_main.jsp");
      break;  
    case '400': // home
      window.open("http://english.kotra.or.kr/");
      break;  
    case '500': // home
      //window.open("http://www.mocie.go.kr");
      window.open("http://www.mke.go.kr/language/eng/index.jsp");
      break;  
    case '600': // home
      window.open("http://www.nso.go.kr/eng2006/");
      break;  
    case '700': // home
      window.open("http://www.kimm.re.kr/english/main.php");
      break;
	case '800': // home
      window.open("http://www.ifr.org");
      break;
  }
}


/* Go Top Link ***************************************** */
function topLink(link) {
  switch(link) {
    case '100': // home
      window.location.href = "/EN/main/";
      break;  
    case '200': // login
      window.location.href = "/EN/user/login/";
      break;  
    case '300': // join
      window.location.href = "/EN/user/join/";
      break;  
    case '400': // sitemap
      window.location.href = "/EN/others/sitemap.asp";
      break;  
    case '500': // contact us
      window.location.href = "mailto:komma@komma.org";
      break;  
    case '600': //
      window.location.href = "/EN/common/logout.asp";
      break;  
    case '700': //
      window.location.href = "/EN/user/information/";
      break;
    case '800': //
      window.location.href = "http://www.komma.org/";
      break;
  }
}

function topLink2(link) {
  switch(link) {
    case '100': // home
      window.location.href = "/EN/main/";
      break;  
    case '200': // login
      window.location.href = "/EN/user/login/";
      break;  
    case '300': // join
      window.location.href = "/EN/user/information/";
      break;  
    case '400': // sitemap
      window.location.href = "/EN/others/sitemap.asp";
      break;  
    case '500': // contact us
      window.location.href = "mailto:komma@komma.org";
      break;  
    case '600': //
      window.location.href = "/EN/common/logout.asp";
      break;  
    case '700': //
      window.location.href = "/EN/";
      break;
  }
}


/* Banner ***************************************** */
function banner(link) {
  switch(link) {
    case '100': // 
      window.location.href = "mailto:hykim@komma.org";
      break; 
    case '200': // »ê¾÷ÀÚ¿øºÎ
      window.open("http://www.crip.or.kr","_blank");
      break; 
  }
}

function ImageOut(img) {
  try {
    if(img.src.search(/_on(\.(gif|jpg))$/) != -1) {
      img.src = img.src.replace(/_on(\.(gif|jpg))$/, "_off$1");
    }
  } catch(e) {
  }
}

function ImageOver(img) {
  try {
    if(img.src.search(/_off(\.(gif|jpg))$/) != -1) {
      img.src = img.src.replace(/_off(\.(gif|jpg))$/, "_on$1");
    }
  } catch(e) {
  }
}

function ImageRollover(img) {
  //var img = event.srcElement;

  try {
    if(img.src.search(/_on(\.(gif|jpg))$/) != -1) {
      img.src = img.src.replace(/_on(\.(gif|jpg))$/, "_off$1");
    } else {
      img.src = img.src.replace(/_off(\.(gif|jpg))$/, "_on$1");
    }
  } catch(e) {
    window.alert(e);
  }
}


/* Cookie ***************************************** */
/*
//Old Script
function GetCookie(Name) {
  var search = Name + "="
  if (document.cookie.length > 0) { // ÄíÅ°°¡ ¼³Á¤µÇ¾î ÀÖ´Ù¸é
    offset = document.cookie.indexOf(search)
    if (offset != -1) { // ÄíÅ°°¡ Á¸ÀçÇÏ¸é
      offset += search.length
      // set index of beginning of value
      end = document.cookie.indexOf(";", offset)
      // ÄíÅ° °ªÀÇ ¸¶Áö¸· À§Ä¡ ÀÎµ¦½º ¹øÈ£ ¼³Á¤
      if (end == -1)
        end = document.cookie.length
      return unescape(document.cookie.substring(offset, end))
    }
  }
}
*/

//New Script(20080704_CRYS)
function GetCookie(name) {
  var nameOfCookie = name + "="; 
  var x = 0; 
  while ( x <= document.cookie.length ) {
    var y = (x+nameOfCookie.length); 
    if ( document.cookie.substring( x, y ) == nameOfCookie ) { 
      if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 ) 
        endOfCookie = document.cookie.length; 
      return unescape( document.cookie.substring( y, endOfCookie ) ); 
    } 
    x = document.cookie.indexOf( " ", x ) + 1; 
    if ( x == 0 ) 
      break; 
  } 
  return ""; 
}

/*
//Old Script
function SetCookie(Name,value, exp) { // popup ¿ë
  var expires = new Date();
  expires.setTime(expires.getTime() + 1000 * 3600 * exp);
  document.cookie = Name + "=" + escape(value) + "; path=/; expires=" + expires.toGMTString();
  window.close();
}
*/

//New Script(20080704_CRYS)
function SetCookie(name, value, expiredays)
{
	var todayDate = new Date();
	todayDate.setDate(todayDate.getDate() + expiredays);
	document.cookie = name + "=" + escape(value) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}


/* Popup ***************************************** */
function Open_Popup(pop, width, height) {
  if (GetCookie(pop) != "done") { //SetCookie(pop, "done", 1)
    //Old Script
    //window.open('/main/popup/' + pop, 'popup_' + pop, 'width=' + width + ',height=' + height + ',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0');

    //New Script(20080704_CRYS)
    //window.open("/main/popup/20080609/20080609.htm","20080609","width=402,height=600,top=0,left=0,noresize");
    window.open("/main/popup/" + pop + "/" + pop + ".htm", pop, "width=" + width + ",height=" + height + ",toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
  }
}

// ¿ÜºÎÃ¢¿¡¼­ Opener Ã¢ URLÀ» ÀÌµ¿½ÃÅ°´Â ÇÔ¼ö (Opener Ã¢ Æ÷Ä¿½º Æ÷ÇÔ)
function MoveOpener(page) {
  opener.location.href = page;
  window.close()
  //var test = eval("window.popup_" + pop);
  //opener.focus();
}

// ÆË¾÷Ã¢¿¡¼­ ¿À´ÃÇÏ·ç ¿­Áö¾Ê±â ¿É¼Ç Ã¼Å© ÇÔ¼ö
function NoView(pop, expiredays) { 
	SetCookie(pop, "done" , 1); 
	self.close(); 
}

// °³ÀÎÁ¤º¸º¸È£Á¤Ã¥ ÆË¾÷Ã¢ ¿ÀÇÂ (20090601_CRYS)
function OpenPrivacy() {
  window.open("/others/privacy.asp", "privacyPopup", "width=588, height=676, fullscreen=0,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
}

