str = '<a href="http://www.samsung.com/fr/imprimante" target="_top"><img src="images/gnb/sub_titile.gif"  onmouseover="menuOn(this)" onmouseout="menuOut(this)" id=\'snb_title\' /></a>';
str += '<ul id="snb">';
str += '	<li><a href="http://www.samsung.com/fr/imprimante/solutionsdimpression"target="_top"><img src="images/gnb/snb_1.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a>';
str += '		<ul style="background-color:#ffffff; width:160px;">';
str += '			<li><a href="http://www.samsung.com/fr/imprimante/solutions"target="_top"><img src="images/gnb/snb_1_1.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a></li>';
str += '			<li><a href="http://www.samsung.com/fr/imprimante/produits"target="_top"><img src="images/gnb/snb_1_2.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a></li>';
//str += '			<li><a href="printing/whereToBuy.html"><img src="images/gnb/snb_1_3.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a></li>';
str += '		</ul>';
str += '	</li>';
str += '	<li><a href="http://www.samsung.com/fr/imprimante/decouverte" target="_top"><img src="images/gnb/snb_2.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a>';
str += '		<ul>';
str += '			<li><a href="http://www.samsung.com/fr/imprimante/pourquoisamsung"target="_top"><img src="images/gnb/snb_2_1.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a></li>';
str += '			<li><a href="http://www.samsung.com/fr/imprimante/recompenses" target="_top"><img src="images/gnb/snb_2_2.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a></li>';
str += '			<li><a href="http://www.samsung.com/fr/imprimante/sucess-story" target="_top"><img src="images/gnb/snb_2_3.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a></li>';
str += '			<li><a href="http://www.samsung.com/fr/imprimante/environnement" target="_top"><img src="images/gnb/snb_2_4.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a></li>';
//str += '			<li><a href="learning/whitePapers.html"><img src="images/gnb/snb_2_5.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a></li>';
str += '		</ul>';
str += '	</li>';
str += '	<li><a href="http://www.samsung.com/fr/imprimante/demandeinformation" target="_top"><img src="images/gnb/snb_4_2.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a>';
str += '	</li>';
str += '	<li><a href="http://www.samsung.com/fr/imprimante/revuedepresse" target="_top"><img src="images/gnb/snb_3.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a>';
//str += '		<ul>';
//str += '			<li><a href="/press/statement.html"><img src="images/gnb/snb_3_1.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a></li>';
//
//str += '		</ul>';
str += '	</li>';
str += '	<li><a href="http://www.samsung.com/fr/imprimante/support" target="_top"><img src="images/gnb/snb_4.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a>';
str += '		<ul>';
str += '			<li><a href="http://www.samsung.com/fr/support/faqs/supportFaq.do#"target="_blank"><img src="images/gnb/snb_4_1.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a></li>';
//str += '			<li><a href="support/onlineSupport.html"><img src="images/gnb/snb_4_2.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a></li>';
str += '			<li><a href="http://www.samsung.com/fr/support/download/supportDownMain.do#"target="_blank"><img src="images/gnb/snb_4_3.gif" onmouseover="menuOn(this)" onmouseout="menuOut(this)"/></a></li>';
str += '		</ul>';
str += '	</li>';
str += '</ul>';
str += '<script type="text/javascript" language="javascript">';
str += 'var flashobj = new makeobject(\'flash\',\'flash/topBanner/topBanner.swf\',\'160\',\'130\',\'flashobj\',\'00\');';
str += 'flashobj.writetag();';
str += '</script>';
//str += '<a href="learning/awards.html"><img src="images/snb_award02.png" class="png24" style="margin-top:10px; padding-bottom:30px;"/></a>';


document.write(str);

	var speedPercent = 0.2; // 높을수록 속도증가
	var submnu_h = 27; // 서브메뉴 이미지 높이값
	var checkCalculate;
	var TimerRoop;

	var speedCalculate = function(result,targetResult) {
		if(result>targetResult) {
			check = (((targetResult - result) * speedPercent) < -1) ? true : false;
		} else {
			check = (((targetResult - result) * speedPercent) > 1) ? true : false;
		}

		if(result==targetResult) {
			return targetResult;
		}	else {
			if(check) {
				result += (targetResult - result) * speedPercent;
			}	else {
				result = ((targetResult - result)>0) ? result+1 : result-1;
			}
			return parseInt(result);
		}
	}

	var initsnb = function(obj) {
		var getsnb = document.getElementById(obj).childNodes;
		for(i=0;i<getsnb.length;i++) {
			if(getsnb.item(i).nodeType==1) {
				getsnb.item(i).onmouseover = function() {
					clearInterval(TimerRoop);
					var getSubsnb = (this.getElementsByTagName('ul')[0]) ? this.getElementsByTagName('ul') : false;
					if(getSubsnb != false) {
						var getSubsnblist = getSubsnb.item(0).getElementsByTagName('li');
						var goalpoint = submnu_h * getSubsnblist.length;
						TimerRoop = window.setInterval( function() {
							execResult(getSubsnb,goalpoint);
						},20);
					} else {

						TimerRoop = window.setInterval( function() {
							execResult(getsnb,0,'nosubmnu');
						},20);
					}
				}

				getsnb.item(i).onmouseout = function() {
					if(pagecode[0]-1>=0) getsnb[pagecode[0]-1].onmouseover();
					else {
						clearInterval(TimerRoop);
						
						TimerRoop = window.setInterval( function() {
							execResult(getsnb,0,'nosubmnu');
						},20);
					}
				}
			}

		}

		pagecode = pagecode.split('-');
		if(pagecode[0] == 0) { // 코드값이 없는 main 예외처리. 나중에 수정해야함
			exceptimage = document.getElementById('snb_title');
			exceptimage.src = exceptimage.src.replace('.gif','_on.gif');
			exceptimage.onmouseover = function() {
				this.src = this.src;
			}

			exceptimage.onmouseout = function() {
				this.src = this.src;
			}

		} else {
			for(k=0;k<getsnb.length;k++) {
				if(getsnb[k].nodeType != 1) getsnb[k].parentNode.removeChild(getsnb[k]);
			}

			recentActive = getsnb[pagecode[0]-1];
			recentActiveimg = recentActive.getElementsByTagName('img')[0];

			recentActiveSub = (getsnb[pagecode[0]-1].getElementsByTagName('ul')[0]) ? getsnb[pagecode[0]-1].getElementsByTagName('ul')[0] : false;

			if(recentActiveSub != false) {

    			if((pagecode[1]-1) < 0)
    			  pagecodeValue = 0;
    			else
    			  pagecodeValue = (pagecode[1]-1);

					recentActiveSubimg = recentActiveSub.getElementsByTagName('a')[pagecodeValue].getElementsByTagName('img')[0];

					recentActive.onmouseover();
                              
                              
    			if((pagecode[1]-1) < 0) {
    			  //recentActiveSubimg.onmouseout();
    			} else {
					recentActiveSubimg.onmouseover();
					recentActiveSubimg.onmouseover = function() { this.src = this.src; }
					recentActiveSubimg.onmouseout = function() { this.src = this.src; }
    			  
				}
				
				
			}

			recentActiveimg.onmouseover();

			recentActiveimg.onmouseover = function() { this.src = this.src; }
			recentActiveimg.onmouseout = function() { this.src = this.src; }

		}


	}

	var execResult = function(obj,goalpoint,switche) {
		var checkInstance = new Array();
		var checkCalculate = 0;
		if(switche == 'nosubmnu') {
			getParentList = obj;
			for(i=0;i<getParentList.length;i++) {
				if(getParentList[i].getElementsByTagName('ul')[0]) {
					if(getParentList[i].nodeType == 1 && getParentList[i].getElementsByTagName('ul')[0] == obj[0]) {
						h_recent = obj.item(0).clientHeight;
						obj.item(0).style.height = speedCalculate(h_recent,goalpoint)+"px";
						if(parseInt(obj.item(0).clientHeight) == goalpoint) {
							checkInstance[i] = true;
						} else {
							checkInstance[i] = false;
						}
						//document.getElementById('t'+i).innerHTML += obj.item(0).style.height+"<br>";

					} else {
						t_recent = getParentList[i].getElementsByTagName('ul')[0].clientHeight;
						getParentList[i].getElementsByTagName('ul').item(0).style.height = speedCalculate(t_recent,0)+"px";
						if(getParentList[i].getElementsByTagName('ul').item(0).clientHeight == 0) {
							checkInstance[i] = true;
						} else {
							checkInstance[i] = false;
						}
						//document.getElementById('t'+i).innerHTML += getParentList[i].getElementsByTagName('ul').item(0).style.height+"<br>";
					}
				}
			}

			for(j=0;j<checkInstance.length;j++) {
				if(checkInstance[j] == true) { checkCalculate++; }
			}

		} else {
			getParentList = obj.item(0).parentNode.parentNode.childNodes;
			for(i=0;i<getParentList.length;i++) {
				if(getParentList[i].getElementsByTagName('ul')[0]) {
					if(getParentList[i].nodeType == 1 && getParentList[i].getElementsByTagName('ul')[0] == obj[0]) {
						h_recent = obj.item(0).clientHeight;
						obj.item(0).style.height = speedCalculate(h_recent,goalpoint)+"px";
						if(parseInt(obj.item(0).clientHeight) == goalpoint) {
							checkInstance[i] = true;
						} else {
							checkInstance[i] = false;
						}
						//document.getElementById('t'+i).innerHTML += obj.item(0).style.height+"<br>";

					} else {
						t_recent = getParentList[i].getElementsByTagName('ul')[0].clientHeight;
						getParentList[i].getElementsByTagName('ul').item(0).style.height = speedCalculate(t_recent,0)+"px";
						if(getParentList[i].getElementsByTagName('ul').item(0).clientHeight == 0) {
							checkInstance[i] = true;
						} else {
							checkInstance[i] = false;
						}
						//document.getElementById('t'+i).innerHTML += getParentList[i].getElementsByTagName('ul').item(0).style.height+"<br>";
					}
				}
			}

			for(j=0;j<checkInstance.length;j++) {
				if(checkInstance[j] == true) { checkCalculate++; }
			}
		}

		if(checkCalculate==checkInstance.length) { clearInterval(TimerRoop); }

	}

initsnb('snb');

function siteLink(url, target){
  switch(target){
    case "_blank":
      window.open(url,"blank","");
      break;
    case "_self":
      document.location.href = url;
      break;
    case "_parent":
      parent.document.location.href = url;
      break;
    case "_top":
      top.document.location.href = url;
      break;
    case "_opener":
      opener.document.location.href = url;
      break;
    default:
      break;
  }
}
