// alert, $.blockUI() »ç¿ë
(function($) {
$.alert = function(message) {
if (!$.blockUI) {
$.getScript('http://lib.loan7.net/jq/jquery.blockUI/jquery.blockUI.js');
alert(message);
return false;
}
if (!document.all) message = message.split('').join(' ');
$.blockUI({
message:'
' + message + '
\
\
',
css:{'cursor':'default'},
overlayCSS:{'cursor':'default'}
});
};
})(jQuery);
// ¾×Ƽºê¿¢½º ¼³Ä¡ ¿©ºÎ
function axExists(ProgID) {
try {
var myobj = new ActiveXObject(ProgID);
return (myobj != null);
}
catch (e) {
return false;
}
}
// À̹ÌÁö À©µµ¿ì
var imgWinObj = new Image();
var imgWinObj = new Image();
function imgWin(imgName) {
imgWinObj.src = imgName;
//setTimeout("createImgWin(imgWinObj)", 100);
createImgWin(imgWinObj);
}
function createImgWin(imgWinObj) {
if (!imgWinObj.complete) {
setTimeout("createImgWin(imgWinObj)", 100);
return;
}
var w = imgWinObj.width;
var h = imgWinObj.height;
if (w > screen.availWidth) w = screen.availWidth;
if (h > screen.availHeight) h = screen.availHeight;
var sc = w == screen.availWidth || h == screen.availHeight ? "yes" : "no";
imageWin = window.open("", "imgWin", "width=" + w + ",height=" + h + ",scrollbars=" + sc + ",resizable=yes");
imageWin.document.write("::");
imageWin.document.write("");
imageWin.document.write("
");
imageWin.document.write("");
imageWin.document.title = imgWinObj.src;
}
// ¸¶¿ì½º xy
function pageXY(event) {
var tempX, tempY;
if (jQuery.browser.msie) {
tempX = event.clientX + document.body.scrollLeft;
tempY = event.clientY + document.body.scrollTop;
} else {
tempX = event.pageX;
tempY = event.pageY;
}
return {x:tempX, y:tempY};
}
function mouseXY(event) {
return pageXY(event);
}
function clientXY(event) {
var tempX, tempY;
if (jQuery.browser.msie) {
tempX = event.clientX;
tempY = event.clientY;
} else {
tempX = event.pageX - $(document.body).scrollLeft();
tempY = event.pageY - $(document.body).scrollTop();
}
return {x:tempX, y:tempY};
}
// body Å©±â
function bodySize() {
var w, h;
if (self.innerHeight) { // IE ¿Ü ¸ðµç ºê¶ó¿ìÀú
w = self.innerWidth;
h = self.innerHeight;
}
else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict ¸ðµå
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
}
else if (document.body) { // ´Ù¸¥ IE ºê¶ó¿ìÀú
w = document.body.clientWidth;
h = document.body.clientHeight;
}
return {width:w, height:h};
}
// Example:
// writeCookie("myCookie", "my name", 24);
// Stores the string "my name" in the cookie "myCookie" which expires after 24 hours.
function writeCookie(name, value, hours, path) {
var expire = "";
if(hours != null) {
expire = new Date((new Date()).getTime() + hours * 3600000);
expire = "; expires=" + expire.toGMTString();
}
var dir = "";
if (path != null) {
dir += "; path=" + path;
}
else {
dir += "; path=/";
}
//document.cookie = name + "=" + escape(value) + expire;
//document.cookie = name + "=" + value + dir + expire;
document.cookie = name + "=" + value.replace(/(^\s*)|(\s*$)/g, "") + dir + expire;
}
// Example:
// alert( readCookie("myCookie") );
function readCookie(name) {
var cookieValue = "";
var search = name + "=";
if(document.cookie.length > 0) {
offset = document.cookie.indexOf(search);
if (offset != -1) {
offset += search.length;
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
cookieValue = unescape(document.cookie.substring(offset, end))
}
}
return cookieValue;
}
// PHPÀÇ rand()
function rand(minNo, maxNo) {
return Math.floor(Math.random() * (maxNo - minNo + 1)) + minNo;
}
// ¹®ÀÚ¿ ÀÚ¸£±â
function cutStr(str, limit) {
var tmpStr = str;
var byte_count = 0;
var len = str.length;
var dot = "";
for (i=0; i < len; i++){
byte_count += chrByte(str.charAt(i));
if (byte_count == limit-1){
if (chrByte(str.charAt(i + 1)) == 2) {
tmpStr = str.substring(0,i+1);
dot = "...";
}
else {
if(i + 2 != len) dot = "...";
tmpStr = str.substring(0,i+2);
}
break;
}
else if (byte_count == limit) {
if(i + 1 != len) dot = "...";
tmpStr = str.substring(0,i+1);
break;
}
}
return tmpStr + dot;
}
function chrByte (chr) {
return escape(chr).length > 4 ? 2 : 1;
}
// PHPÀÇ strlen°ú µ¿ÀÏ
function strlen(str) {
var i, j=0;
for(i=0; i