function check_submit(form,du,msg){
var s_ex = "2008-04";
var e_ex = "2008-06";
var e_msg = "end";
if(document.search.ftype.value == "only_edate"){
var sdate = "2000-01-01";
var edate = document.search.edate.value;
e_ex = e_ex + "-30";
e_msg = "Inquiry";
var chkmax = 10;
}else if(document.search.ftype.value == "short_date"){
var sdate = document.search.sdate.value;
var edate = document.search.edate.value;
var chkmax = 7;
}else{
var sdate = document.search.sdate.value;
var edate = document.search.edate.value;
s_ex = s_ex + "-01";
e_ex = e_ex + "-30";	var chkmax = 10;
}
if(sdate == "") {
alert(MsgErrDate+'\n\nex) '+s_ex);
document.search.sdate.focus();
return false;
}else if(sdate.length < chkmax){
alert(MsgErrDate+'\n\nex) '+s_ex);
document.search.sdate.focus();
return false;
}else if(edate == "") {
alert(MsgErrDate+'\n\nex) '+e_ex);
document.search.edate.focus();
return false;
}else if(edate.length < chkmax){
alert(MsgErrDate+'\n\nex) '+e_ex);
document.search.edate.focus();
return false;
}else{
if(document.search.ftype.value != "only_edate"){
var sElement =  sdate.split('-');
var eElement =  edate.split('-');
if(eElement[2]){
var e_day = eElement[2] / 30;
}else{
e_day = 0;
}
if(sElement[2]){
var s_day = sElement[2] / 30;
}else{
s_day = 0;
}
var duration =  (eElement[0] * 12 + eElement[1] * 1 + e_day) - (sElement[0] * 12 + sElement[1] * 1 + s_day);
if(duration < 0){
alert(MsgErrPeriod);
document.search.edate.focus();
return false;
}else if(duration > du){
alert(msg);
document.search.edate.focus();
return false;
}//end if
}//end if NOT only_edate
if(document.search.sdate.value != document.detail.sdate.value || document.search.edate.value != document.detail.edate.value){
document.search.preset.value = "";
}//end if
return true;
}//end if
}//end function
function where_x(a){
var myWidth = screen.availWidth;
myWidth =  (myWidth - a) / 2;
return myWidth;
}
function where_y(a){
var myHeight = screen.availHeight;
myHeight =  ((myHeight - a) / 2);
return myHeight;
}
function detail(account,s,e,kind,memo){

document.detail.acc.value = account;
document.detail.sdate.value = s;
document.detail.edate.value = e;
document.detail.kind.value = kind;
document.detail.memo.value = memo;
document.detail.target = "_self";
document.detail.submit();
}
function msg(msg){
var xx = document.body.scrollTop;
$('#msgbox').text(msg).css("top",xx);
$('#msgbox').show();
setTimeout(function(){$('#msgbox').hide();},1000);
}
function inquiry(file,sdate,edate,preset){
location.href = "/" + file + ".php?sdate=" + sdate + "&edate=" + edate + "&preset=" + preset;
}//end function
function newwin(url,urlvar,w,h){
var xx = document.body.scrollTop;
if (xx == 0) {xx=-1;}
var x_px = where_x(w);
var y_px = where_y(h);
window.open(url + '?xx='+xx+urlvar, 'newwin', 'resizable=0, status=1, toolbar=0, menubar=0, width='+w+', height='+h+', left='+x_px+', top='+y_px+', scrollbars=1');
}//end func.
function helpwin(file,id){
var x_px = where_x(670);
var y_px = where_y(400);
window.open('/help/?view=small&f='+file+'#'+id, 'helpwin', 'resizable=0, status=1, toolbar=0, menubar=0, width=760, height=400, left='+x_px+', top='+y_px+', scrollbars=1');
}//end func.
onDisplayEx = 1;
onDisplayPr = 1;
function view_ex(a){
if(a == "fix"){
if(onDisplayEx == 1){
$('.e_flo').css({'visibility' : 'hidden'});	$('.none').css({'visibility' : 'hidden'});	onDisplayEx = 0;
}else{
$('.e_flo').css({'visibility' : 'visible'});	$('.none').css({'visibility' : 'visible'});	onDisplayEx = 1;
}//end if
}else{
if(onDisplayEx == 1){
$('.e_fix').css({'visibility' : 'hidden'});	$('.none').css({'visibility' : 'hidden'});	onDisplayEx = 0;
}else{
$('.e_fix').css({'visibility' : 'visible'});	$('.none').css({'visibility' : 'visible'});	onDisplayEx = 1;
}//end if
}//end if
}
function view_pr(a){
if(a == "fix"){
if(onDisplayPr == 1){
$('.p_flo').css({'visibility' : 'hidden'});	$('.pnone').css({'visibility' : 'hidden'});	onDisplayPr = 0;
}else{
$('.p_flo').css({'visibility' : 'visible'});	$('.pnone').css({'visibility' : 'visible'});	onDisplayPr = 1;
}//end if
}else{
if(onDisplayPr == 1){
$('.p_fix').css({'visibility' : 'hidden'});	$('.pnone').css({'visibility' : 'hidden'});	onDisplayPr = 0;
}else{
$('.p_fix').css({'visibility' : 'visible'});	$('.pnone').css({'visibility' : 'visible'});	onDisplayPr = 1;
}//end if
}//end if
}
function go_pl(date){
var dateElement = date.split("|");
if(dateElement[1].length == 10){
document.detail.preset.value = "";
}//end if
detail(dateElement[3],dateElement[0],dateElement[1],dateElement[2],'');
}//end function go_pl
function go_bs(a){
location.href = "bs.php?edate=" + ThisEdate[a] + "&preset=";
}//end function go_bs
function flash_detail(str){
var strElement = str.split("|");
var acc = strElement[0];
if(strElement[1]){
var memo_num = strElement[1];
var memo = MemoArr[memo_num];
}else{
var memo = "";
}//end if
detail(acc,ThisSdate,ThisEdate,ThisKind,memo);
}
function mdetail(acc,kind,memo){
detail(acc,ThisSdate,ThisEdate,kind,memo);
}
function createMemo(id,fl,memo,l,t,w,h,f,clr){
if(f == '0'){
var checked = "value='0'";
}else{
var checked = "value='1' checked";
}//end if
var thisleft = xy.left + parseInt(l);
if(g4_is_ie){
var thistop = t*9.9/10-2;
}else if(g4_is_safari){
var thistop = t-1;
thisleft = thisleft+114;
}else{
var thistop = t;
}//end if
var str = "<div id='c"+id+"' style='position:absolute;width:"+w+"px;height:"+h+"px;left:"+thisleft+"px;top:"+thistop+"px;z-index:500;' class='memo_c'>\n\n<div id='t"+id+"' style='visibility:hidden;' class='memo_top'>\n<table border=0 cellspacing=0 cellpadding=0 width='100%'><tr><td width=15><input type=checkbox "+checked+" style='margin-top:2px;' id='chk"+id+"' onClick=\"fixMemo('"+id+"');\"><input type=hidden id='menu"+id+"' value='"+fl+"'></td><td>&nbsp;</td><td width=15><img src='/i/win_x.gif' border=0 onClick=\"delMemo('"+id+"');\"></td></tr></table></div>\n<textarea id='val"+id+"' style='background:#"+clr+";"+ImeMode+"' class='memo_cont' onChange=\"saveMemoCont('"+id+"');\">"+memo+"</textarea>\n<div class='memo_size'><img src='/i/resize.png' border=0 id='size"+id+"' style='cursor: se-resize;'></div>\n</div>\n\n";
$('#cont').before(str);
}//end for
function newPostIt(clr,dom){
dom.blur();
var x_px = where_x(430);
var y_px = where_y(400);
$.post("/memo/new_memo.php",{
menu : Menu,
color : clr,
baseleft : x_px,
basetop : y_px,
basewidth : '200',
baseheight : '200'
},function(data){
createMemo(data,Menu,"",x_px,y_px,"200","200","0",clr);
$('#c'+data).hover(function(){$('#t'+data).css({'visibility':'visible'});},function(){$('#t'+data).css({'visibility':'hidden'});});
$('#c'+data).Resizable(
{
minWidth: 70,
dragHandle: '#t'+data,
handlers: {
se:'#size'+data
},
onDragStop: function(){
saveMemoPos(data);
},
onResize: function(size){
$('#m'+data).css({'width': size.width + 'px'});
},
onStop: function(){
saveMemoScale(data);
}
}
);
});
}//end func.
function saveMemoPos(id){
var thispos = $('#c'+id).position();
var thisleft =  thispos.left - xy.left;
if(g4_is_ie){
var thistop = thispos.top*10/9.9+2;
}else if(g4_is_safari){
var thistop = thispos.top + 1;
thisleft = thisleft-114;
}else{
var thistop = thispos.top;
}//end if
if(thistop < 60) {thistop = 60;$('#c'+id).css('top',60);}
$.post("/memo/save_position.php",{
thisid : id,
thisleft : thisleft,
thistop : thistop
});
}//end if
function saveMemoScale(id){
var thisHeight = $('#c'+id).height();
if(g4_is_ie) thisHeight = thisHeight - 40;
$.post("/memo/save_scale.php",{
thisid : id,
thiswidth : $('#c'+id).width(),
thisheight : thisHeight
});
}//end if
function fixMemo(id){
var thisval = $('#chk'+id).val();
if(thisval == '0'){
thisval = 1;
}else{
thisval = 0;
var thismenu = $('#menu'+id).val();
if(Menu != thismenu)
$('#c'+id).remove();
}
$('#chk'+id).val(thisval);
$.post("/memo/save_fix.php",{
thisid : id,
fixed : thisval
});
if(thisval == '0'){
msg(completePostItFixNo);
}else{
msg(completePostItFix);
}
}//end if
function delMemo(id){
if(confirm(ErrReally)){
$.post("/memo/del_memo.php",{
thisid : id
},function(){
$('#c'+id).remove();
});
msg(completePostItDel);
}//end confirm
}
function saveMemoCont(id){
var cont = $('#val'+id).val();
$.post("/memo/save_cont.php",{
thisid : id,
cont : cont
});
msg(completePostItMod);
}
function go_site(url){
location.href = "http://www.icashhouse." + url;
}//end func.
function fsearchbox_submit(f){
if (f.stx.value == '')
{
alert("검색어를 입력하세요.");
f.stx.select();
f.stx.focus();
return;
}
f.action = "../bbs/search.php";
f.submit();
}
function resize(t,d,cooname){
if(t == "t"){
if(d == "up"){
Max = Max + yTerm;
set_cookie(cooname +'Max', Max, 300, g4_cookie_domain);	}else if(d == "dn"){
Max = Max - yTerm;
set_cookie(cooname +'Max', Max, 300, g4_cookie_domain);	}else{
Max = rawMax;
delete_cookie(cooname +'Max');
}//end if
printChart(5);	}else{
if(d == "up"){
Min = Min + yTerm;
set_cookie(cooname +'Min', Min, 300, g4_cookie_domain);	}else if(d=="dn"){
Min = Min - yTerm;
set_cookie(cooname +'Min', Min, 300, g4_cookie_domain);
}else{
Min = rawMin;
delete_cookie(cooname +'Min');
}//end if
printChart(5);	}//end if
}//end func.
function tweetLoad(){
var urirex = /(https?):\/\/+([\w\d:#@%\/;$()~_?\+-=\\\.&]*)/g;
var hashrex = /\#+([\w\d:#@%/;$()~_?\+-=\\\.&]*)/g;
var thashuri = "http://search.twitter.com/search?q=%23";	var display = 'No more records found';
var url = (page==1 && fileTime < refreshTime)?'twitter_cache.php':'http://search.twitter.com/search.json?&q=@icashhouse&callback=?&page='+page;
$.getJSON(url, function(data){
if(data.results.length < 1){
$('a#more_twit').parent('div').text(display);
}else{
display = '';
$.each(data.results, function(i,tweet){
ttext = tweet.text.replace(urirex, '<a href="$1://$2" title="">$2</a>');
ttext = ttext.replace(hashrex, '<a href="' + thashuri  + '$1" title="">#$1</a>');
display += "<div class='twit'><a href='http://twitter.com/"+tweet.from_user+"' target='_blank'><img src='"+tweet.profile_image_url+"' border='0' alt='"+tweet.from_user+"' align='left' class='twit_image'/></a><div class='twit_cont'><a href='http://twitter.com/"+tweet.from_user+"' target='_blank' class='twit_id'><b>"+tweet.from_user+"</b></a> "+ttext+"<div class='twit_cont_created'>"+tweet.created_at.replace('+0000','')+" via "+tweet.source.replace(/&quot;/g,"'").replace(/&lt;/g,'<').replace(/&gt;/g,'>')+"</div></div></div>";
});
display += "<hr size='1' color='silver' noshade />";
$('div#twit_list').append(display);
if(page == 1 && fileTime >= refreshTime){
var a = $.toJSON(data);
$.post("twitter_cache_refresh.php",{ d : a });
}
page++;
}
});
}//end of func
function star(bi){
if($('#fa_'+bi).length){
var b = bi.split("__");
i = b[1];
b = b[0];
jQuery.post("/community_star.php",{
mode : 'd',
board : b,
wr_id : i
},function(d){
if(!d){
$('img#'+bi).attr('src','/i/light_no.gif');
$('div#fa_'+bi).remove();
}
});
}else{
var b = bi.split("__");
i = b[1];
b = b[0];
t = jQuery('span#t'+i).text();
var s = "<div class='s_line' id='fa_"+bi+"'>";
s+= "<img src='/i/light_yes.gif' border='0' align='left' class='ss_img' onClick='star(\""+bi+"\");'/>";
s+= "<a href='/bbs/board.php?bo_table="+b+"&wr_id="+i+"'>"+t+"</a>";
s+= "</div>";
jQuery.post("/community_star.php",{
mode : 'i',
board : b,
wr_id : i,
wr_subject : t
},function(d){
if(!d){
$('img#'+bi).attr('src','/i/light_yes.gif');
$('#star').prepend(s);
}
});
}
}
