(function ($) {
$(document).ready(function() {
if($('.showrooms').hasClass('showrooms')){
$('.showrooms').ajaxTransRoomXML(6)
}
if($('.showRoom').hasClass('showRoom')){
$('.showRoom').showRoomFun()
}
if($('.noticeUL').hasClass('noticeUL')){
$('.noticeUL').ajaxTransXML('notice')
}
$(".quickmenu li").hover(function(event){
$(this).stop().animate({width:180,queue: true,opacity:1}, {duration:300}, "easeInOutBack");
$(this).find('.on').stop().animate({width:180,queue: true,opacity:1}, {duration:300}, "easeInOutBack");
},function(event){
$(this).stop().animate({width:41,queue: true,opacity:1}, {duration:300}, "easeInOutBack");
$(this).find('.on').stop().animate({width:0,queue: true,opacity:1}, {duration:300}, "easeInOutBack");
});
$('.numberC').blur(function(){
$(this).numberFormat();
})
$('.numberC').focus(function(){
$(this).removeText();
})
$(".date").datepicker({
dateFormat: 'yy-mm-dd',
monthNamesShort: ['1¿ù','2¿ù','3¿ù','4¿ù','5¿ù','6¿ù','7¿ù','8¿ù','9¿ù','10¿ù','11¿ù','12¿ù'],
dayNamesMin: ['ÀÏ','¿ù','È','¼ö','¸ñ','±Ý','Åä'],
weekHeader: 'Wk',
changeMonth: true, //¿ùº¯°æ°¡´É
changeYear: true, //³âº¯°æ°¡´É
yearRange:'1990:+2', // ¿¬µµ ¼¿·ºÆ® ¹Ú½º ¹üÀ§(ÇöÀç¿Í °°À¸¸é 1988~ÇöÀç³â)
showMonthAfterYear: true, //³â µÚ¿¡ ¿ù Ç¥½Ã
buttonImageOnly: true, //À̹ÌÁöÇ¥½Ã
buttonText: '³¯Â¥¸¦ ¼±ÅÃÇϼ¼¿ä',
autoSize: false, //¿ÀÅ丮»çÀÌÁî(bodyµî »óÀ§Å±×ÀÇ ¼³Á¤¿¡ µû¸¥´Ù)
buttonImage: '/images//dot_10.gif', //À̹ÌÁöÁÖ¼Ò /wtm/images/egovframework/wtm2/sub/bull_calendar.gif
showOn: "both", //¿¤¸®¸ÕÆ®¿Í À̹ÌÁö µ¿½Ã »ç¿ë
showButtonPanel:true,
currentText:'¿À´Ã'
});
//$(".date").attr('readonly','readonly')
$(".date").change(function(){
var over_obj = $(this).attr('notover')
if(over_obj || $(this).val()){
if($(over_obj).val()>$(this).val()){
$(this).val('')
alert('±â°£ ¼³Á¤ÀÌ À߸øµÇ¾ú½À´Ï´Ù.');
$(this).focus();
}
}
})
$("input.all").click(function(){
var chk = $("input.all").is(':checked');
$('input[name="chk"]').each(function(){
this.checked = chk;
});
})
$('input[name="chk"]').click(function(){
$("input.all").each(function(){
this.checked = $('input[name="chk"]').length == $('input[name="chk"]:checked').length;
});
})
if($('div.buttonSelect').hasClass('buttonSelect')){
//$('div.buttonSelect').parent().css({position: 'relative',height: 50});
$('div.buttonSelect').prepend("¡å")
$('div.buttonSelect').css({width:'180px',overflow: 'hidden','text-align': 'right',position: 'absolute'});
$('div.buttonSelect').find('input[type=button]').css('width','160px');
var temp_height = $('div.buttonSelect').height();
$('div.buttonSelect').css({height:27});
$('span.list','div.buttonSelect').click(function(){
if($('div.buttonSelect').height() != '27'){
$('div.buttonSelect').animate({height:27,queue: true,opacity:1}, {duration:300}, "easeInOutBack");
}else{
$('div.buttonSelect').animate({height:temp_height,queue: true,opacity:1}, {duration:300}, "easeInOutBack");
};
})
$('div.buttonSelect').find('input[type=button]').click(function(){
$('div.buttonSelect').animate({height:25,queue: true,opacity:1}, {duration:300}, "easeInOutBack");
$('.list','div.buttonSelect').after($(this));
});
}
//¹ÚÀοø ȸ¿ø °¡ÀÔüũ Ãß°¡... 2013³â 03¿ù 27ÀÏ
$('.MemberSubmit').click(function(){
if($('#userID').val() == "" & $('#userID').val().length == 0){
alert('»ç¿ëÀÚ ¾ÆÀ̵𸦠ÀÔ·ÂÇØÁÖ¼¼¿ä!!');
}else if($('#userID').val().length < 4)
{
alert('»ç¿ëÀÚ ¾ÆÀ̵ð´Â 4ÀÚ ÀÌ»ó 15ÀÌÇÏ ÀÔ´Ï´Ù.');
}else if($('#userPW').val().length == 0 & $('#userPW').val() == "")
{
alert('ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä!');
}else if($('#userPwCheck').val().length == 0 & $('#userPwCheck').val() == "")
{
alert('È®ÀÎ ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä!');
}else if($('#userPW').val() != $('#userPwCheck').val())
{
alert('ºñ¹Ð¹øÈ£°¡ ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù.');
}
});
//¹ÚÀοø ȸ¿ø °¡ÀÔüũ Ãß°¡... 2013³â 03¿ù 27ÀÏ
$('.dialog-close').css({cursor: 'pointer'})
$('.dialog-close').click(function(e){
$('.ui-dialog-content').dialog('close');
})
});
$.fn.removeText = function(_v){
if (typeof(_v)==="undefined")
{
$(this).each(function(){
this.value = this.value.replace(/[^0-9]/g,'');
});
}
else
{
return _v.replace(/[^0-9]/g,'');
}
};
$.fn.numberFormat = function(_v){
this.proc = function(_v){
var tmp = '',
number = '',
cutlen = 3,
comma = ','
i = 0,
len = _v.length,
mod = (len % cutlen),
k = cutlen - mod;
for (i; i < len; i++)
{
number = number + _v.charAt(i);
if (i < len - 1)
{
k++;
if ((k % cutlen) == 0)
{
number = number + comma;
k = 0;
}
}
}
return number;
};
var proc = this.proc;
if (typeof(_v)==="undefined")
{
$(this).each(function(){
this.value = proc($(this).removeText(this.value));
});
}
else
{
return proc(_v);
}
};
$.fn.onlyNumber = function (p) {
$(this).each(function(i) {
$(this).attr({'style':'text-align:right'});
this.value = $(this).removeText(this.value);
this.value = $(this).numberFormat(this.value);
$(this).bind('keypress keyup',function(e){
this.value = $(this).removeText(this.value);
this.value = $(this).numberFormat(this.value);
});
});
};
$.fn.dialogCreat = function (param) {
var _this = $('.'+param.className);
if(!$(_this).hasClass(param.className)){
var div = document.createElement('div');
$(div).addClass(param.className);
$('body').append(div)
_this = $(div);
}
if(param.body_css){
$(_this).css(param.body_css);
}
if(param.iframe){
if($(_this).children('iframe').hasClass('dialog-iframe') && $(_this).children('iframe').attr('src') == param.iframe && !param.refresh){
}else{
$(_this).html('');
var iframe = document.createElement('iframe');
$(iframe).attr({'class':'dialog-iframe'});
$(iframe).attr({src:param.iframe,
frameborder:"0",
scrolling:((param.iframe_scroll)?param.iframe_scroll:'no'),
allowTransparency:true,
width:((param.iframe_width)?((param.iframe_width<0)?param.width+param.iframe_width:param.iframe_width):"100%"),
height:((param.iframe_height)?((param.iframe_height<0)?param.height+param.iframe_height:param.iframe_height):"100%")
})
$(_this).append(iframe)
}
}else if(param.html && $(_this).html() != param.html){
$(_this).html('');
$(_this).append(param.html)
}else if(param.refresh && param.html){
$(_this).html('');
$(_this).append(param.html)
}
var b1 = ($(_this).parent().hasClass('ui-dialog'))
var b2 = ($(_this).parent('.ui-dialog').css('display') == 'block');
var b3 = objToString(param.buttons);
if(b1 && b2 && !b3){
$(_this).dialog('close');
}else{
$(_this).dialog(param);
}
if(param.titleHide){
$(_this).prev('.ui-dialog-titlebar').hide();
}else{
$(_this).prev('.ui-dialog-titlebar').show();
};
if(param.draggable){
$(_this).parent().draggable({cancel:null});
}
if(param.title_namebarHide){
$(_this).find('.dialog-iframe').load(function(){
$(_this).find('.dialog-iframe').contents().find('table.title_namebar').hide();
});
}
if(param.refresh){
// $('.ui-icon-closethick').before('data-icon="refresh"')
}
};
$.fn.pharos_refresh = function(){
var obj_iframe = $(this).children('iframe')
$(obj_iframe).attr('src',$(obj_iframe).attr('src'))
}
$.fn.ajaxTransRoomXML = function(param){
var _this=$(this);
var request = $.ajax({
url: "./xml/showrooms.xml?subID="+param,
type: "post", //get, post ¹æ½Ä
data: "",
dataType: 'xml', //or xml or script or html
async: true
});
request.done(function(data) {
var cell_title = $(data).find('room_list');
var cell = $(data).find('room_list').find('room');
if(cell_title && $(_this).find('.line').children('li').length == 0){
var title = cell_title.attr('text').split(',');
for(var i=0;i'+t+'')
}
$(_this).find('.line').find('li').click(function(){
$(_this).find('.line').find('li').removeClass('active');
$(this).addClass('active');
$('.showrooms').ajaxTransRoomXML($(this).attr('subID'))
});
}
var room = $(_this).find('.rooms')
$(room).html('');
cell.each(function(i) {
var src = $(this).attr('img');
$(room).append('
')
});
$(room).find('li').click(function(){
document.location.href = "/subPage.html?mode=2&subID="+param;
});
})
request.fail(function(jqXHR, textStatus) {
alert('Àá½ÃÈÄ ´Ù½Ã ½ÃµµÇØ ÁֽʽÿÀ')
});
request.always(function() {
});
}
$.fn.ajaxTransXML = function(_type){
var _this = $(this)
var request = $.ajax({
url: "./xml/notice.xml?mode=6&subID=1",
type: "post", //get, post ¹æ½Ä
data: "{mode:6,subID:1}",
dataType: 'xml', //or xml or script or html
async: true
});
request.done(function(data) {
var cell = $(data).find(_type+"_list").find(_type);
var len = cell.length;
if(len){
$(_this).html('');
cell.each(function(i) {
if(i < 5){
var _title = $(this).attr('title');
var _date = $(this).attr('date').substr(2,8);
var _link_url = $(this).attr('link_url');
var li = document.createElement('li');
$(li).html("")
$(li).attr({'_url':_link_url})
$(li).click(function(){
document.location.href = $(this).attr('_url')
})
$(_this).append(li)
}
});
$('.noticeUL').hide();
$('.noticeUL:nth(0)').fadeIn();
$('.noticeUL:nth(0)').find('li').css('left',80);
$('.noticeUL:nth(0)').find('li').css('opacity',0);
moveEffect($('.noticeUL:nth(0)'),0);
}else{
$(_this).html('');
var li = document.createElement('li');
$(li).css({"text-align": "center"})
$(li).html('
no Contents')
$(_this).append(li)
}
})
request.fail(function(jqXHR, textStatus) {
alert('Àá½ÃÈÄ ´Ù½Ã ½ÃµµÇØ ÁֽʽÿÀ')
});
request.always(function() {
});
};
function moveEffect(id,n){
$(id).find('li'+':nth('+n+')').animate({left: 0,opacity : 1,queue: true}, "swing", function(){ if(n < 5) moveEffect(id,n+1);});
}
$.fn.showRoomFun = function(){
var _this = $(this);
var obj = $(this).children('ul').children('li')
var len = obj.length
var count = len - 1;
//alert(count);
obj.each(function(i){
if(i == count){
var src = $(this).children('img').attr('src');
$(this).addClass('active')
$(this).after("")
}
$(this).hover(function(event){
$(obj).removeClass('active');
$(this).addClass('active');
if($('.showRoomBig .pic_before').hasClass('pic_before')){
}else{
$('.showRoomBig .pic').after('')
}
var b_src = $('.showRoomBig .pic').children('img').attr('src');
var src = $(this).children('img').attr('src');
$('.showRoomBig .pic_before img').attr('src',b_src).stop().animate({opacity : 0,queue: true}, "swing", function(){ });
$('.showRoomBig .pic img').attr('src',src).stop().css('opacity',0).animate({opacity : 1,queue: true}, "swing", function(){ });
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////À̹ÌÁö ÃøÁ¤Çؼ À̹ÌÁö Å©±âÁ¶Àý
//alert(($('.pic').height()))
if(($('.pic img').height())>400){
$('.showRoomBig').css('height',$('.pic').height())
$('.photoRoomClassAll').css('height',$('.pic').height()-500)
$('.photoRoomClassB').css('height',$('.pic').height()+200)
}
else{
$('.showRoomBig').css('height',$('.pic').height())
$('.photoRoomClassAll').css('height',$('.pic').height()-500)
$('.photoRoomClassB').css('height',$('.pic').height()+200)
}
if(($('.photoRoomClassB').height())>800){
//alert("asdsa");
$('.white_bg img').show();
}
else{
$('.white_bg img').hide();
}
/*
$('.showRoomBig .pic img').load(function(){
$('.showRoomBig').css('height', $('.showRoomBig .pic img').height())
})*/
},function(event){
});
})
}
})(jQuery);
function dateAdd(dday,addDay) {
if(dday){
var getDate = new Date(dday.split('-')[0],dday.split('-')[1],dday.split('-')[2]);
}else{
var getDate = new Date();
}
var addDate = getDate.getTime() + (addDay * 24 * 60 * 60 * 1000);
getDate.setTime(addDate);
var year = getDate.getFullYear();
var month = getDate.getMonth();
if(month == 0){
month = 1;
}
var date = getDate.getDate();
if (month < 10) month = "0" + month;
if (date < 10) date = "0" + date;
return year + "-" + month + "-" + date;
}
function objToString (obj) {
var str = '';
for (var p in obj) {
if (obj.hasOwnProperty(p)) {
str += p + '::' + obj[p] + '\n';
}
}
return str;
}
function dialogClose(type,url){
if(!type){
(function ($){
$('.ui-dialog-content').dialog('close');
})(jQuery);
}else if(type == 'refresh'){
if(url){
parent.document.location.href = parent.document.location.href;
}else{
location.reload();
}
}
}