var domain = "cancerexpo.org";

function setCookie(name,value,interval,ival) {
	var cookieString = name +"="+ escape(value) +"; path=/";
	cookieString += ((domain == '') ? "" : "; domain="+ domain);
	if (interval != '') {
		var nowDate = new Date();
		if (interval == 'f') {
			var arrDate = ival.split("-"); //2008-01-03 Çü½Ä
			nowDate = new Date(arrDate[0],arrDate[1]-1,arrDate[2],nowDate.getHours(),nowDate.getMinutes(),nowDate.getSeconds());
		} else if (interval != '') {
			ival = parseInt(ival);
			if (interval == 'y') {
				nowDate.setYear(nowDate.getYear() + ival);
			} else if (interval == 'm') {
				nowDate.setMonth(nowDate.getMonth() + ival);
			} else if (interval == 'd') {
				nowDate.setDate(nowDate.getDate() + ival);
			} else if (interval == 'hh') {
				nowDate.setHours(nowDate.getHours() + ival);
			} else if (interval == 'mm') {
				nowDate.setMinutes(nowDate.getMinutes() + ival);
			} else if (interval == 'ss') {
				nowDate.setSeconds(nowDate.getSeconds() + ival);
			}
		}
		cookieString += "; expires="+ nowDate;
	}
	document.cookie = cookieString;
}
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 "";
}
function getCookieKey(key,name) {
	var KeyNameCookie = getCookie(key);
	var arrkeyCookieName = KeyNameCookie.split("&");
	for (var i = 0; i < arrkeyCookieName.length-1; i++) {
		if (arrkeyCookieName[i].search(name) != -1) {
			arrkeyCookieName[i] = arrkeyCookieName[i].slice(name.length+1, arrkeyCookieName[i].length);
			return unescape(arrkeyCookieName[i]);
			break;
		}
	}
	return "";
}
function deleteCookie(name) {
		var exp = new Date();
		exp.setTime (exp.getTime() - 1);
		var cval = getCookie (name);
		document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}
function isDelete(ele) {
	if (confirm ("»èÁ¦µÈ µ¥ÀÌÅ¸´Â º¹±¸ÇÏ½Ç¼ö ¾ø½À´Ï´Ù.\nÁ¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?   ")) {
		location.href = ele.href;
	}
}
function confirmSignIn(nextURL) {
	if (confirm ("¿äÃ»ÇÏ½Å ¼­ºñ½º´Â È¸¿øÁ¤º¸¸¦ ¿ä±¸ÇÕ´Ï´Ù. ·Î±×ÀÎÀ» ÇÏ½Ã°Ú½À´Ï±î?		   ")) {
		location.href = nextURL;
	}
}
function confirmMsg(nextURL, msg) {
	if (confirm (msg)) {
		location.href = nextURL;
	}
}
function openBrWindow(theURL,theTarget,width,height,scrollbars,resizable,status,align,valign) {
	var left,top;
	if (scrollbars == 'yes') {
		width += 17
	}
	height += 25;
	if (align == 'center') {
		left = ((window.screen.width * 5 / 10) - (width / 2));
	} else if (align == 'right') {
		left = window.screen.width - width;
	} else {
		left = 1;
	}
	if (valign == 'middle') {
		top = ((window.screen.height * 5 / 10) - (height / 2));
	} else if (valign == 'bottom') {
		top = window.screen.height - height;
	} else {
		top = 1;
	}
	window.open(theURL,theTarget,"toolbar=no,location=no,directories=no,status="+ status +",menubar=no,scrollbars="+ scrollbars +",resizable="+ resizable +",left="+ left +", top="+ top +", width="+ width +",height="+ height +"");
}
function ImageViewer(strImagePath) {
	window.open('/modules/image.viewer.asp?ImageURL='+strImagePath+'','ImageGallery',"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,left=0,top=0,width=0,height=0");
}
function innerOpen(url,width,height,isScroll){
	window.showModelessDialog(url,window,'dialogWidth:'+width+'px;dialogHeight:'+height+'px;status:no;edge:raised;scroll:'+isScroll);
}
function showDisplay(ObjID) {
	document.all[ObjID].style.display="block";
}
function hideDisplay(ObjID) {
	document.all[ObjID].style.display="none";
}
function toggleEleCheck (cVal) {
	var obj = document.getElementsByName(cVal);
	var objlength = obj.length;
	for (var i=0; i < objlength; i++)
	{
		if (obj[i].checked)
		{
			obj[i].checked = false;
		} else {
			obj[i].checked = true;
		}
	}
}
function ToggleDisplay(ObjID) {
	var displayStyle = document.all[ObjID].style.display;
	if (displayStyle == "block") {
		document.all[ObjID].style.display="none";
	} else {
		document.all[ObjID].style.display="block";
	}
}
function ToggleVisibility(ObjID) {
	var visibilityStyle = document.all[ObjID].style.visibility;
	if (visibilityStyle == "visible") {
		document.all[ObjID].style.visibility ="hidden";
	} else {
		document.all[ObjID].style.visibility  ="visible";
	}
}
function ToggleClass(ObjID,c1ClassName,c2ClassName) {
	var styleClassName = document.all[ObjID].className;
	if (styleClassName == c1ClassName) {
		document.all[ObjID].className = c2ClassName;
	} else {
		document.all[ObjID].className = c1ClassName;
	}
}
function TextElementSet(formname,fieldgroup,values,parents,closed) {
	var arrfieldname = fieldgroup.split("|");
	var arrvalue = values.split("|");
	for (var i=0; i < arrfieldname.length; i++) {
		if (parents) {
			opener.document.all[formname].all[arrfieldname[i]].value = arrvalue[i];
		} else {
			document.all[formname].all[arrfieldname[i]].value = arrvalue[i];
		}
	}
	if (closed) {
		self.window.close();
	}
}
function openerDiv(objectname, wclose, value, parents) {
   var arrobjectname = objectname.split("|");
   var arrvalue = value.split("|");
	for (var i=0; i < arrobjectname.length; i++) {
		if (parents == "yes") {
			opener.document.all[arrobjectname[i]].innerHTML = arrvalue[i];
		} else {
			document.all[arrobjectname[i]].innerHTML = arrvalue[i];
		}
	}
	if (wclose == 'y') {
		self.window.close();
	}
}
function CheckBoxSelect(frmname,fieldname,checkvalue) {
	var form = document.all[frmname];
	var fieldname = form.all[fieldname];
	if (fieldname == undefined) {
		alert('°³Ã¼°¡ ¾ø½À´Ï´Ù.  ');
		return;
	}
	var checksingle = GetElementSingle(fieldname);
	if (checksingle) {
		fieldname.checked = checkvalue;
	} else {
		for (var i=0;i<fieldname.length ;i++) {
			fieldname[i].checked = checkvalue;
		}
	}
}
function GetElementSingle(objname) {
	if (objname != undefined) {
		if (objname.length == undefined) {
			return true;
		} else {
			return false;
		}
	}
}
function FormReset(formName) {
	document.all[formName].reset();
}
function CopyText(cValue) {
	var doc = document.body.createTextRange();
	doc.findText(cValue);
	doc.execCommand('copy');
}
function LengthLimit(strings,limitlength) {
	var stringslength = strings.length;
	if (stringslength < limitlength) {
		return false;
	} else {
		return true;
	}
}
function FormatNumber(strDigit) {
	var strDigit = new String(strDigit);
	var arrDigits = new Array();
	var chkDigit = /^\d+$/;

	if (strDigit.charAt(0) == 0) {
		strDigit = strDigit.substr(1,strDigit.length);
	}

	var j = 0;
	for (var i=0;i<strDigit.length ;i++ ) {
		if (chkDigit.test(strDigit.charAt(i))) {
			arrDigits[j] = strDigit.charAt(i);
			j++;
		}
	}
	var strCovDigit = new String();
	var intDigitsLength = arrDigits.length;
	for (j=0;j<arrDigits.length ;j++ ) {
		if (((intDigitsLength-j-3)%3 == 0) && (j>0)) {
			strCovDigit += ',';
		}
		strCovDigit += arrDigits[j];
	}
	if (strCovDigit == 0) {
		strCovDigit = 0;
	}
	return strCovDigit;
}
function LongString(objName,cVal) {
	var FormLimit = 102399;
	var TempVar = new String;
	TempVar = cVal;
	if (TempVar.length > FormLimit) {
		form.InfoContents.value = TempVar.substr(0, FormLimit);
		TempVar = TempVar.substr(FormLimit);
		while (TempVar.length > 0) {
			var objTEXTAREA = document.createElement("TEXTAREA");
			objTEXTAREA.name = objName;
			objTEXTAREA.value = TempVar.substr(0, FormLimit);
			form.appendChild(objTEXTAREA);
			TempVar = TempVar.substr(FormLimit);
		}
	}
}
function ImagesResize(oImage,oWidth,intBaseWidth) {
	if (oWidth > intBaseWidth) {
		oImage.width = intBaseWidth;
	}
}
function GoVote(form) {
	var chkItems = false;
	for (var i=0;i<form.vSEQ.length;i++) {
		if (form.vSEQ[i].checked) {
			chkItems = true;
		}
	}
	if (chkItems) {
		return true;
	} else {
		alert('Ç×¸ñÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä.	   ');
		return false;
	}
}
function fe(s,d,w,h,t){
	document.write ("<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0'' width='"+w+"' height='"+h+"' id='"+d+"'><param name=wmode value="+t+" /><param name=movie value="+s+" /><param name=quality value=high /><embed src="+s+" quality=high wmode="+t+" width="+w+" height="+h+" type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object>");
}
function fn_sml(vIdx) {
	var l = document.getElementsByName("smlmenu").length;
	for (var i=1; i<=l; i++) {
		var obj = document.getElementById('smlimg'+i);
		if (i == parseInt(vIdx)) {
			obj.src = obj.src.replace('.off.','.on.');
		} else {
			obj.src = obj.src.replace('.on.','.off.');
		}
	}
}

