function numberFormat(numm) 
{
	var num = Number(numm).toString();
	var len = num.length;
	var lst = len % 3;
	var ret = '';

	if( lst )
		ret = num.substring(0, lst);

	if( lst < len ) {
		if( lst )
			ret += ',';

		for( i = lst; i < len - lst; i += 3 ) {
			ret += num.substring(i, i+3);
			if( i + 3 < len )
				ret += ',';
		}
	}

	return ret;
}

function StringBuffer() { this.buffer = []; }
StringBuffer.prototype.append = function(string) 
{
	this.buffer.push(string); 
	return this; 
} 

StringBuffer.prototype.toString = function()
{
	return this.buffer.join(",");
}

function Search()
{
	var target = 'http://www.happycampus.com/search/?qu=';
	var keyword = encodeURIComponent(document.getElementById('qu').value);
	var type = '&type=' + document.getElementById('type').value;
	if(keyword=='') {
		//alert('검색어를 먼저 입력하세요');
		//document.getElementById('qu').focus();
		location.href = '/';
		return;
	}
	location.href = target + keyword + type;
}

function enterSearch()
{
	if(event.keyCode == '13')
		Search();
	else
		return;
}


function pop_charge() {
	pv = window.open('https://pay.happycampus.com/global/step01.html?P_BRANCH=IPKUM&type=filling','payment', 'width=418,height=427,scrollbars=no');
	window.pv.focus();
	return false;
}

function getAbsX(el) {
	if (el.x) return el.x;
	pos = 0;

	while (el != null) {
		pos += el["offsetLeft"];
		el = el.offsetParent;
	}

	if(document) {
		if(document.body.scrollWidth > document.body.offsetWidth)
			sw = document.body.scrollWidth;
		else 
			sw = document.body.offsetWidth;
		if(pos+200 > sw)
			pos = sw-350;
	} else {
		if( pos > 670 )
			pos = 670;
	}
	return pos;
}

function getAbsY(el) {
	if (el.y) return el.y;
	pos = 0;
	while (el != null) {
		pos += el["offsetTop"];
		el = el.offsetParent;
	}
	return pos;
}

var divx, divy;
var stendx = 900;
var stendy = 80;
var movement;
var stspeed = 40;
var ll = document.layers;
var clientHeight = 0;

function getX(el)
{
	if(document.layers)
		xx = el.left;
	else
		xx = el.style.left;
	return parseInt(xx);
}

function getY(el)
{
	if(document.layers)
		xx = el.top;
	else
		xx = el.style.top;
	return parseInt(xx);
}

function setX(el, x) 
{
	ll?el.left=x:el.style.left=x;
}

function setY(el, y) 
{
	ll?el.top=y:el.style.top=y;
}

function email_collection_refuse(thisValue){
	var divx = getAbsX(thisValue) - 100;
	var divy = getAbsY(thisValue) - 100;
	setX(document.getElementById('email_gather'), divx);
	setY(document.getElementById('email_gather'), divy);
	document.getElementById('email_gather').style.display = "block";
}
