function common_swf(objhtml) {
    document.write(objhtml);
}

function common_open_url(url_str , param) {
  if ( window.open(url_str,'',param) == false ) {
    alert('XP ÆË¾÷ Â÷´Ü ±â´ÉÀ» ²ô¼¼¿ä.');
  }
}

function OhMyGod() {
  common_open_url("http://web.humoruniv.com/prog/ohmygod/ohmygod.html", "fullscreen=yes,scrollbars=no");
} 

function WhatMyPass() {
  window.open('http://ns.humoruniv.com/web/idpw_qus.html','ºñ¹Ð¹øÈ£Ã£±â','scrollbars=no,toolbar=no,directories=no,status=no,width=380,height=230,resizable=no,menubar=no,top=10,left=340');
}

function common_real_len(Source)
{
  len = Source.length;

  for (i = 0; i < Source.length; i++)
    if (Source.charCodeAt(i) > 127)
      len++;

  return len;
}


function OnOff_Layers() {
var e = document.getElementById("login_view");
 
 if (e.style.visibility == 'visible') {
  e.style.visibility = 'hidden';
 } else {
  e.style.visibility = 'visible';
 }
}

function OnOff_Layers_bak() {
  if (document.all.login_view.style.visibility == 'hidden') {
	document.all.login_view.style.visibility = 'visible';
  } else {
	document.all.login_view.style.visibility = 'hidden';
  }
}

function OnImageResizing(img) {
  if(img.width > 600) {
    img.width = 600;
  }
}

function profile_popup(id) {
        //var url = "http://msg.humoruniv.com/profile/profile.html?user_address=" + id;
        var url = "http://mini.humoruniv.com/index.html?nick=" + id;
        aaa = window.open(url,'','left margin=0 top margin=0 width=903,height=688');
        //aaa = window.open(url,'','left margin=0 top margin=0 width=880,height=600');

        if (aaa == false) alert('XP ÆË¾÷Â÷´ÜÀ» ²¨ÁÖ¼Å¾ß ÇÕ´Ï´Ù.');
}

function bookmarksite(title,url){
	if (window.sidebar) // firefox
		window.sidebar.addPanel(title, url, "");
	else if(window.opera && window.print) { // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',url);
		elem.setAttribute('title',title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)// ie
		window.external.AddFavorite(url, title);
}

function common_isnumber(str) {
	var numstr = "0123456789";
	var i = 0; 
	
	for (i = 0; i < str.length; i++ ) {
	  if (numstr.indexOf(str.charAt(i)) == -1) return false;
	}
	
	return true;
}

function total_graph_bak( nWidth, nHeight, nData ){
  document.write("<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' ");
  document.write("codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,22,0' ");
  document.write("width='" + nWidth + "' height='" + nHeight + "'>");
  document.write("<param name='movie' value='/images/engine/pollgraph.swf'>");
  document.write("<param name='quality' value='high'>");
  //document.write("<param name='flashVars' value='Indata=10,100;20,200;30,300;40,400;50,700;60,300;70,900&Userdata=300&'>");
  document.write("<param name='flashVars' value='" + nData + "'>");
  document.write("</object>");
}


function total_graph(f_name,f_value,f_width,f_height,f_align,f_param){
 document.write('<object id="'+f_name+'" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="'+f_width+'" height="'+f_height+'">') ;
 document.write('<param name="movie" value="'+f_value+'.swf?'+f_param+'" />') ;
 document.write('<param name="quality" value="high" />') ;
 document.write('<param name="menu" value="false" />') ;
 document.write('<param name="wmode" value="transparent" />') ;
 document.write('<param name="allowScriptAccess" value="always" />');
 document.write('<param name="showLiveConnect" " value="true" />' );
 document.write('<param name="allowFullScreen" value="true" />') ;
 document.write('<PARAM NAME=scale VALUE=noscale> ');
 document.write('<PARAM NAME="SAlign" VALUE="'+f_align+'">') ;
 document.write('<param name="FlashVars" value="'+f_param+'">');
 document.write('<embed src="'+f_value+'.swf?'+f_param+'" quality="high" name="'+f_name+'" SAlign="'+f_align+'" scale=noscale width="'+f_width+'" height="'+f_height+'" allowScriptAccess="always"  allowFullScreen="true" showLiveConnect="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" />') ;
 document.write('</object>') ; 
}


  function JSOnInitScript(object) {
    if ( hu_getCookie("hu_on_bar") == "set" ) {
	// setted
    } else {
        hu_setCookie("hu_on_bar", "set", 30);
    }

    if ( hu_getCookie("hu_on_init") == "inited" ) {
        // toolvar check already.
    } else {
        // toolvar
        hu_setCookie("hu_on_init", "inited", 30);
    }
  }

  function hu_on_adrun() {
    if ( hu_getCookie("hu_on_init") == "inited" ) {
        // not view...
    } else {
        hu_on_var.style.display = 'block';
    }
  }

  /**
   * ÄíÅ°°ª ÃßÃâ
   * @param cookieName ÄíÅ°¸í
   */
  function hu_getCookie( cookieName ) {

    var search = cookieName + "=";
    var cookie = document.cookie;

    // ÇöÀç ÄíÅ°°¡ Á¸ÀçÇÒ °æ¿ì
    if( cookie.length > 0 ) {
      // ÇØ´ç ÄíÅ°¸íÀÌ Á¸ÀçÇÏ´ÂÁö °Ë»öÇÑ ÈÄ Á¸ÀçÇÏ¸é À§Ä¡¸¦ ¸®ÅÏ.
      startIndex = cookie.indexOf( cookieName );

      // ¸¸¾à Á¸ÀçÇÑ´Ù¸é
      if( startIndex != -1 ) {
        // °ªÀ» ¾ò¾î³»±â À§ÇØ ½ÃÀÛ ÀÎµ¦½º Á¶Àý
        startIndex += cookieName.length;

        // °ªÀ» ¾ò¾î³»±â À§ÇØ Á¾·á ÀÎµ¦½º ÃßÃâ
        endIndex = cookie.indexOf( ";", startIndex );

        // ¸¸¾à Á¾·á ÀÎµ¦½º¸¦ ¸øÃ£°Ô µÇ¸é ÄíÅ° ÀüÃ¼±æÀÌ·Î ¼³Á¤
        if( endIndex == -1) endIndex = cookie.length;

        // ÄíÅ°°ªÀ» ÃßÃâÇÏ¿© ¸®ÅÏ
        return unescape( cookie.substring( startIndex + 1, endIndex ) );
      } 
    }

    return false;
  }
 
 
  /**
   * ÄíÅ° ¼³Á¤
   * @param cookieName ÄíÅ°¸í
   * @param cookieValue ÄíÅ°°ª
   * @param expireDay ÄíÅ° À¯È¿³¯Â¥
   */
  function hu_setCookie( cookieName, cookieValue, expireDate ) {
    var today = new Date();
    today.setDate( today.getDate() + parseInt( expireDate ) );
    document.cookie = cookieName + "=" + escape( cookieValue ) + "; path=/; expires=" + today.toGMTString() + ";";
    //document.cookie = cookieName + "=" + escape( cookieValue ) + "; path=/; ";
  }

  function hu_setCookie2( cookieName, cookieValue ) {
    var today = new Date();
    document.cookie = cookieName + "=" + escape( cookieValue ) + "; path=/; ";
  }

  function hu_getschkey( cookie_name ){ 
	/*
	var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );
	if ( results )    return ( unescape ( results[2] ) );  
	else return null;
	*/

	return hu_getCookie( cookie_name );
  }

  function huon_close() {
	document.getElementById('hu_on_var').style.display = 'none';

	if ( hu_getCookie("hu_on_init") == "inited" ) {
		// pass
	} else {
		document.cookie = "hu_on_init=" + escape( "inited" ) + "; path=/; ";
	}
  }

  function huon_move(nick) {
	if ( hu_getCookie("hu_on_init") == "inited" ) {
		profile_popup(nick);
	} else {
		top.location.href = 'http://web.humoruniv.com/hu_on/index.html?nick=' + nick;
	}
  }

  function hu_sckput() {
	var rndnum = Math.floor(Math.random() * 10); // 0 ~ 9 int
	if ( hu_getschkey("sck" + rndnum) == false ) {
		document.getElementById('search_text').value = '';
	} else {
		document.getElementById('search_text').value = hu_getschkey("sck" + rndnum);
	}
  }

	// banner open
	function exp_banner_open(mode) {
	//	exp_banner_inner(mode);	
		if (document.getElementById(mode).style.display == 'none') {
			document.getElementById(mode).style.display = 'block';
        	}
	}

	// banner close
	function exp_banner_close(mode) {
		if (top.document.getElementById(mode).style.display == 'block') {
			top.document.getElementById(mode).style.display = 'none';
        	}
	}

	function exp_banner_inner(mode){
	alert(mode);
		switch(mode){
			case "b_wide_exp" :
			//var inner_str = '<scr' + 'ipt src="http://ad.humoruniv.com/adj.humoruniv/adcode=569"></scr' + 'ipt>';
				inner_str = '<script src="http://ad.humoruniv.com/adj.humoruniv/pgcode=569"></script>';

				break;
			case "b_branding_exp" :
				inner_str = '<script src="http://ad.humoruniv.com/adj.humoruniv/pgcode=512"></script>';
				break;
			case "b_drag_exp" :
				inner_str = '<script src="http://ad.humoruniv.com/adj.humoruniv/pgcode=566"></script>';
				break;
		}
		
	alert(inner_str);
		document.getElementById(mode).innerHTML = inner_str;

		document.getElementById(mode).style.display = 'block';
	}

function getLocationHref(){ return document.location.href;} 

