function roll(st,color) { 
	idx=eval(st);
	idx.style.backgroundColor=color;
}

///////// ÀÚµ¿¸µÅ© /////////////////////////////////////////////////////////////////////
function autolink( id )
{
	//alert(id);
	var container = document.getElementById(id);
	var doc = container.innerHTML;
	var regSRC = new RegExp("(src|href)=(\'|\")(http|https|ftp|telnet|news|irc)://([-/.a-zA-Z0-9_~#%$?&=:200-377();|°¡-ÆR]+)","gi");
	var regURL = new RegExp("(http|https|ftp|telnet|news|irc)://([-/.a-zA-Z0-9_~#%$?&=:200-377();|°¡-ÆR]+)","gi");
	var regEmail = new RegExp("([_a-z0-9]+[_a-z0-9+-]+@[a-z0-9+-]+\.[a-z0-9+-]+[\.a-z0-9+-]+)","gi");
	doc = doc.replace(regSRC,"$1=$2donelink://$4");
	doc = doc.replace(regURL,"<a href='$1://$2' target='_blank'>$1://$2</a>");
	doc = doc.replace(regEmail,"<a href='mailto:$1'>$1</a>");
	container.innerHTML = doc.replace( /donelink/gi, 'http' );
}

function alertID()
{
	for(i = 0; i < document.all.length; i++)
	if( document.all[i].id != "" ) alert(document.all[i].id);
}
///////////////////////// ÀÚµ¿¸µÅ© //////////////////////////////////////////////////////////

// setCookie
function setCookie( name, value, expiredays ) 
{
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/;"
}

// getCookie
function t_getCookie(name){
        var arg = name + "=";
        var alen = arg.length;
        var clen=document.cookie.length;
        var i=0;
        
        while(i< clen){
                var j = i+alen;
                if(document.cookie.substring(i,j)==arg){
                        var end = document.cookie.indexOf(";",j);
                        if(end== -1)
                                end = document.cookie.length;
                        return unescape(document.cookie.substring(j,end));
                }
        i=document.cookie.indexOf(" ",i)+1;
        if (i==0) break;
        }
        return null;
}

function t_setCookie(name,value,expires){
        document.cookie=name + "=" + escape(value)+
        ((expires == null)? "" : (" ; expires=" + expires.toGMTString()));
}
function t_setcookieVariables(){
        var today = new Date();
        var expires=new Date();
        expires.setTime(today.getTime()+ 1000*60*60*24*365);
        
        setCookie("news_title","",expires)
        
}
function searchMail(level,activate,locat,where,search,search_type){
	location.href=("index.php?inc=client_mailing&level="+level+"&activate="+activate+"&locat="+locat+"&search_type="+search_type+"&where="+where+"&search="+search);
	return;
}

function searchMail2(level,activate,locat,where,search,search_type){
	var brw=window.open("index.php?inc=client_mailing&level="+level+"&activate="+activate+"&locat="+locat+"&search_type="+search_type+"&where="+where+"&search="+search);
	brw.focus();
	return;
}

function SuppliersSearchMail2(s_mode,search_type,get){
	var sub="s"+s_mode+"mail";
	var url="index.php?inc=suppliers_mailing&sub="+sub+"&search_type="+search_type+"&"+get;
	//alert(sub);
	window.open(url);
	return;
}


function optionList(table,no,name,title,fld,vvs,type,where,txt,sort) {
	//alert(table);
	if ( fld==null ) fld="";
	if ( vvs==null ) vvs="";
	if ( type==null ) type="";
	if ( where==null ) where="";
	if ( txt==null ) txt="";
	if ( sort==null ) sort="";

	browsing_window = window.open('index_pop.php?incf=more/optionList&table='+table+'&no='+no+'&name='+name+'&title='+title+'&fld='+fld+'&vvs='+vvs+'&type='+type+'&where='+where+'&txt='+txt+'&sort='+sort, '__optionList_'+table, 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=600, height=300');
	browsing_window.focus();
	return;
}

function onlyNumber(charName) {
	var nums="0123456789";
	var result="";
	for (i=0 ; i < charName.value.length ; i++ ) {
		if(nums.indexOf(charName.value.substring(i,i+1)) != -1) {
			result=result+charName.value.substring(i,i+1);
		}
	}
	//alert(result);
	charName.value= result;
}
function nextFild(fd1,fd2,size){
	if ( fd1.value.length==size ){
		fd2.focus();
		//fd2.select();
	}
	return;
}
function preFild(fd1,fd2,size) {
	if ( fd1.value.length != size ) {
		fd1.focus();
	}
	return;
}


function projectSelect(fName) {
	browsing_window = window.open('index_pop.php?incf=more/project_select&status=PG&fName='+fName, 'projectSelect', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=600, height=300');
	browsing_window.focus();
	return;
}

function cMan_add(cno,mno) {
	if ( cno == null ) cno="";
	if ( mno == null ) mno="";
	browsing_window = window.open('index_pop.php?incf=client/mngr_w&cno='+cno+'&mno='+mno, '__CMan', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=600, height=484');
	browsing_window.focus();
	return;
}


function addCommas( strValue ){ 
	var objRegExp = new RegExp('(-?[0-9]+)([0-9]{3})'); 

	while(objRegExp.test(strValue)) { 
		strValue = strValue.replace(objRegExp, '$1,$2'); 
	} 
	return strValue; 
}
function flashView(source,w,h){
	alert('test');
	var flash_text="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\"";
	if ( w ) flash_text+="width=\""+w+"\"";
	if ( h ) flash_text+="height=\""+h+"\"";
	flash_text+="><param name=\"movie\" value=\""+src+"\" /><param name=\"quality\" value=\"high\" /><embed src=\""+source+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+w+"\" height=\""+h+"\"></embed></object>";
	document.write(flash_text);
	return;
}

function clientInfo(no) {
	if ( no > 0 && no != "" ) {
		var browzing=window.open('index_pop.php?incf=client/mngt_v&no='+no, 'ClientINFO', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=915,height=500');
		browzing.focus();
	} else alert('Å¬¶óÀÌ¾ðÆ®°¡ ¼±ÅÃµÇÁö ¾Ê¾Ò½À´Ï´Ù.');

	return;
}
