/* 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 = "/komma/"
      break;10
    case '1010':
      window.location.href = "/komma/greetings/greetings.asp"
      break;
    case '1020':
      window.location.href = "/komma/introduction/introduction.asp"
      break;
    case '1030':
      window.location.href = "/komma/history/history.asp"
      break;
    case '1040':
      window.location.href = "/komma/business/business.asp"
      break;
    case '1050':
      window.location.href = "/komma/vision/vision.asp"
      break;
    case '1060':
      window.location.href = "/komma/ci/ci.asp"
      break;
    case '1070':
      window.location.href = "/komma/organization/organization.asp"
      break;
    case '1080':
      window.location.href = "/komma/location/location.asp"
      break;
    case '1090':
      window.location.href = "/komma/membership/"
      break;
	case '1091':
      window.location.href = "/komma/membership/procedure.asp"
      break;	
	case '1100':
      window.location.href = "/komma/banner/banner.asp"
      break;
    case '2000':
      window.location.href = "/activity/"
      break;
    case '2010':
      window.location.href = "/activity/notice/"
      break;
    case '2020':
      window.location.href = "/activity/offer/list.asp"
      break;
    case '2030':
      window.location.href = "/activity/exhibition/schedule.asp"
      break;
	case '2031':
      window.location.href = "/activity/exhibition/information/list.asp"
      break;	
    case '2040':
      window.location.href = "/activity/member/document/"
      break;
    case '2050':
      window.location.href = "/activity/publication/"
      break;
    case '2060':
      window.location.href = "/activity/research/"
      break;
    case '3000':
      window.location.href = "/member/"
      break;
    case '3010':
      window.location.href = "/member/member/search/"
      break;
    //case '3020':
    //  window.location.href = "/member/product/find/"
    //  break;
    case '3020':
      window.location.href = "/member/press/"
      break;
    case '3030':
      window.location.href = "/member/news/"
      break;
    case '4000':
      window.location.href = "/statistic/state/"
      break;
    case '4010':
      window.location.href = "/statistic/state/"
      break;
	case '4011':
      window.location.href = "/statistic/state/product.asp"
      break;
	case '4012':
      window.location.href = "/statistic/state/export.asp"
      break;
	case '4013':
      window.location.href = "/statistic/state/phase.asp"
      break;
    case '4020':
      window.location.href = "/statistic/market/"
      break;
    case '4030':
      window.location.href = "/statistic/montly/"
      break;
	case '4031':
      window.location.href = "/statistic/montly/list.asp?code1=020100&code2=020100"
      break;  
    case '4040':
      window.location.href = "/statistic/overseas/"
      break;
	case '4041':
      window.location.href = "/statistic/overseas/product.asp"
      break;
	case '4042':
      window.location.href = "/statistic/overseas/export.asp"
      break;
	case '4043':
      window.location.href = "/statistic/overseas/country_japan.asp"
      break;
	case '4044':
      window.location.href = "/statistic/overseas/ranking.asp"
      break;	
    case '4050':
      window.location.href = "/statistic/internal/"
      break;
	case '4051':
      window.location.href = "/statistic/internal/order/summary.asp"
      break;
	case '4052':
      window.location.href = "/statistic/internal/product/summary.asp"
      break;
	case '4053':
      window.location.href = "/statistic/internal/export/country.asp"
      break;
	case '4054':
      window.location.href = "/statistic/internal/import/country.asp"
      break;
    case '4060':
      window.location.href = "/statistic/hscode/"
      break;  
    case '5000':
      window.location.href = "/industrial/"
      break;
    case '5010':
      window.location.href = "/industrial/machinetool/"
      break;
    case '5011':
      window.location.href = "/industrial/machinetool/method.asp"
      break;
    case '5012':
      window.location.href = "/industrial/machinetool/type.asp"
      break;
    case '5013':
      window.location.href = "/industrial/machinetool/phase.asp"
      break;
    case '5014':
      window.location.href = "/industrial/machinetool/name.asp"
      break;	  
    case '5015':
      window.location.href = "/industrial/machinetool/trend.asp"
      break;
    case '5020':
      window.location.href = "/industrial/industry/"
      break;
    case '5030':
      window.location.href = "/industrial/technology/"
      break;
    case '5040':
      window.location.href = "/industrial/patent/"
      break;
    case '5050':
	  window.open("http://www.yestrade.go.kr/");
      //window.location.href = "/industrial/material/"
      break;
    case '5060':
      window.location.href = "/industrial/magazine/"
      break;
    case '5070':
      window.location.href = "/industrial/link/"
      break;
	case '5080':
      window.location.href = "/industrial/pool/"
      break;
    case '6000':
      window.location.href = "/customer/qna/"
      break;
    case '6010':
      window.location.href = "/customer/job/"
      break;
    case '6020':
      window.location.href = "/customer/qna/"
      break;
    case '6030':
      window.location.href = "/customer/suggestion/"
      break;
	case '7010':
      window.location.href = "/user/login/"
      break;
	case '7020':
      window.location.href = "/user/forgot/"
      break; 
	case '7030':
      window.location.href = "/user/join/"
      break;	  
	case '7040':
      window.location.href = "/user/information/"
      break;	  
  }
}


/* Quick Launcher ***************************************** */
function Quick(menuNum) {
  switch(menuNum) {
    case '100': // HOME
      window.location.href = "/main/"
      break;
    case '200': // Àü½ÃÈ¸ ÀÏÁ¤
      window.location.href = "/activity/offer/list.asp"
      break;
    case '300': // È¸¿ø»ç °Ë»ö
      window.location.href = "/member/member/search/list.asp"
      break;
    case '400': // È¸¿ø»ç °¡ÀÔ¾È³»
      window.location.href = "/komma/membership/benefit.asp"
      break;
    case '500': // ¿À½Ã´Â ±æ
      window.location.href = "/komma/location/location.asp"
      break;
    case '600': // SIMTOS 2008
      window.open("http://www.simtos.org/");
      break;
    case '700': //Á¦Á¶¿ë ·Îº¿ Åë°è/
      window.location.href = "/statistic/montly/list.asp?code1=020100&code2=020100"
      break;
    case '800': //
      window.location.href = "/industrial/pool/list.asp"
      break;
    case '900': //
      window.location.href = "/"
      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://www.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");
      break;  
    case '400': // home
      window.open("http://www.kotra.or.kr");
      break;  
    case '500': // home
      window.open("http://www.mocie.go.kr");
      break;  
    case '600': // home
      window.open("http://www.nso.go.kr");
      break;  
    case '700': // home
      window.open("http://www.kimm.re.kr/");
      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 = "/main/";
      break;  
    case '200': // login
      window.location.href = "/user/login/";
      break;  
    case '300': // join
      window.location.href = "/user/join/";
      break;  
    case '400': // sitemap
      window.location.href = "/others/sitemap.asp";
      break;  
    case '500': // contact us
      window.location.href = "mailto:komma@komma.org";
      break;  
    case '600': //
      window.location.href = "/common/logout.asp";
      break;  
    case '700': //
      window.location.href = "/user/information/";
      break;
    case '800': //
      window.location.href = "/en/";
      break;
  }
}

function topLink2(link) {
  switch(link) {
    case '100': // home
      window.location.href = "/main/";
      break;  
    case '200': // login
      window.location.href = "/user/login/";
      break;  
    case '300': // join
      window.location.href = "/user/information/";
      break;  
    case '400': // sitemap
      window.location.href = "/others/sitemap.asp";
      break;  
    case '500': // contact us
      window.location.href = "mailto:komma@komma.org";
      break;  
    case '600': //
      window.location.href = "/common/logout.asp";
      break;  
    case '700': //
      window.location.href = "/";
      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");
  }
}
function Open_Popup2(pop, width, height, topZ, leftZ) {
  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, "top=" + topZ + ", left=" + leftZ + ", 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");
}
