/**
 * @file	: cubecreater/script/commonLib.js
 * @author	: 조일환
 * @brief	: javascript 함수  파일
 **/
/* 문자열 체크 함수 */
var isValid = {
	ID : function (str) {
		var pattern = _REGEXP['id'];
		return (pattern.test(str)) ? true : false;
	}
	,
	SITEID : function (str) {
		var pattern = _REGEXP['siteid'];
		return (pattern.test(str)) ? true : false;
	}
	,
	COMID : function (str) {
		var pattern = _REGEXP['comid'];
		return (pattern.test(str)) ? true : false;
	}
	,
	PW : function (str) {
		var pattern = _REGEXP['passwd'];
		return (pattern.test(str)) ? true : false;
	}
	,
	Phone : function (str) {
		var pattern = _REGEXP['phone'];
		return (pattern.test(str)) ? true : false;
	}
	,
	Zip : function (str) {
		var pattern = _REGEXP['zip'];
		return (pattern.test(str)) ? true : false;
	}
	,
	Jumin : function (str) {
		var pattern = /(^[0-9]{6})-([0-9]{7})/;
		return (pattern.test(str)) ? true : false;
	}
	,
	JuminR : function (str) {
		var pattern = /(^[0-9]{6})-([0-9]{7})/;
		if (pattern.test(str)) {
			var tot=0, result=0, re=0, se_arg=0;
			var chk_num="";
			chk_jm_bh = strReplace("-", "", str);
			if (chk_jm_bh.length != 13) {
				return false;
			}
			else {
				for (var i=0; i < 12; i++) {
				if (isNaN(chk_jm_bh.substr(i, 1))) return false;
					se_arg = i;
					if (i >= 8) se_arg = i - 8;
					tot = tot + Number(chk_jm_bh.substr(i, 1)) * (se_arg + 2)
				}
				 if (chk_num != "err") {
					re = tot % 11;
					result = 11 - re;
					if (result >= 10) result = result - 10;
					if (result != Number(chk_jm_bh.substr(12, 1))) return false;
					if ((Number(chk_jm_bh.substr(6, 1)) < 1) || (Number(chk_jm_bh.substr(6, 1)) > 4))
					return false;
				}
			}
			return true;
		}
		else {
			
		}
		return (pattern.test(str)) ? true : false;
	}
	,
	Num : function (str) {
		var pattern = _REGEXP['number'];
		return (pattern.test(str)) ? true : false;
	}
	,
	Email : function (str) {
		var pattern = _REGEXP['email'];
		return (pattern.test(str)) ? true : false;
	}
	,
	ComNo : function (str) {
		var reg = /([0-9]{3})-?([0-9]{2})-?([0-9]{5})/;
		if (!reg.test(num)) return false;
		num = RegExp.$1 + RegExp.$2 + RegExp.$3;
		var cVal = 0;
		for (var i=0; i<8; i++) {
			var cKeyNum = parseInt(((_tmp = i % 3) == 0) ? 1 : ( _tmp  == 1 ) ? 3 : 7);
			cVal += (parseFloat(num.substring(i,i+1)) * cKeyNum) % 10;
		}
		var li_temp = parseFloat(num.substring(i,i+1)) * 5 + '0';
		cVal += parseFloat(li_temp.substring(0,1)) + parseFloat(li_temp.substring(1,2));
		return (parseInt(num.substring(9,10)) == 10-(cVal % 10)%10);
	}
}

function passLevel(pwd) {
	var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
	var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
	var enoughRegex = new RegExp("(?=.{6,}).*", "g");

	if (pwd.length==0) {
		return 2000;
	}
	else if (false == enoughRegex.test(pwd)) {
		return 1000;
	}
	else if (strongRegex.test(pwd)) {
		return 3;
	}
	else if (mediumRegex.test(pwd)) {
		return 2;
	}
	else {
		return 1;
	}
}

/**
 * @brief : PNG24 투명
 **/
function setPng24(obj) {
	if (Browser == "MSIE 6.0" || Browser == "MSIE6.0" || Browser == "MSIE 5.5") {
		obj.width = obj.height = 1;
		obj.className = obj.className.replace(/\bpng24\b/i, '');
		obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + obj.src + "',sizingMethod='image');"
		obj.src = '';
		return '';
	}
}

/**
 * @brief : strReplace
 **/
function strReplace(org, dest, str) {
	var reg = new RegExp(org, "g");
	return str.replace(reg, dest);
}

function reservationView(rpart, rdoctor) {
	$.ajax({
		type: "POST",
		url: "/common/reservationForm.php",
		data: "rpart="+ rpart +"&rdoctor="+ rdoctor,
		dataType: 'text',
		success: function(returnVal) {
			returnVal = jQuery.trim(returnVal);
			if (returnVal) {
				if (returnVal == "NOTLOGIN") {
					alert("로그인 후 진료예약이 가능합니다.\n로그인 페이지로 이동합니다.");
					window.location.href = _URL['SDOCROOT'] +"/membership/membership01_01.php";
				}
				else {
					showMessageObj(returnVal);
					if (rpart && $('#rpart').val()) {
						inputPopuoPart($('#rpart').val(), $('#rpartname').val(), rdoctor);
					}
				}
			}
		}
	});
}

function fullmenuView() {
	$.ajax({
		type: "POST",
		url: "/fullmenu/fullmenu.php",
		data: "",
		dataType: 'text',
		success: function(returnVal) {
			returnVal = jQuery.trim(returnVal);
			if (returnVal) {
				showMessageObjNon(returnVal);
			}
		}
	});
}

function fullmenuViewSmall(obj) {
	$.ajax({
		type: "POST",
		url: "/fullmenu/fullmenu2.php",
		data: "",
		dataType: 'text',
		success: function(returnVal) {
			returnVal = jQuery.trim(returnVal);
			if (returnVal) {
				messageBoxPosi(returnVal, $('#fullmenu2ButtonImg').position().left, $('#fullmenu2ButtonImg').position().top +30);
			}
		}
	});
}
/** 메인 퀵메뉴 */
function fullmenuViewQuick() {
	$.ajax({
		type: "POST",
		url: "/fullmenu/fullmenu3.php",
		data: "",
		dataType: 'text',
		success: function(returnVal) {
			returnVal = jQuery.trim(returnVal);
			if (returnVal) {
				messageBoxPosi(returnVal, $('#fullmenu3ButtonImg').position().left, $('#fullmenu3ButtonImg').position().top +30);
			}
		}
	});
}

function showAddressSearch() {
	var alertForm = document.createElement("DIV");
	var searchStr = "<div id=\"popupSearchAddress\" title=\"주소 검색\">";
	searchStr += "<div style=\"text-align:center;\">";
	searchStr += "* 찾으시려는 읍/면/동 입력하고 검색을 클릭하십시오.";
	searchStr += "<form action=\"\" onsubmit=\"return searchAddrChk();\" style=\"margin-top: 5px;\">";
	searchStr += "<input type=\"text\" name=\"popupSword\" id=\"popupSword\" class=\"text w180\" />";
	searchStr += "</form>";
	searchStr += "</div>";
	searchStr += "<div id=\"popupResultArea\" class=\"resultArea\" style=\"width:auto;margin:2px 5px 0px 5px;text-align:center;\">";
	searchStr += "</div>";
	searchStr += "</div>";
	$('body').append(searchStr);
	var sword01 = $("#popupSword");
	$("#popupSearchAddress").dialog({
		bgiframe: true,
		modal: true,
		draggable: false,
		resizable: false,
		width: 550,
		buttons: {
			취소: function() {
				$(this).dialog('close');
				sword01.val("");
			},
			주소검색: function() {
				return searchAddrChk();
			}
		}
		,
		close: function() {
			$("#popupSearchAddress").dialog( 'destroy' ) ;
			$("#popupSearchAddress").remove();
		}
	});
}


function searchAddrChk() {
	var sword01 = $("#popupSword");
	if (!sword01.val()) {
		alert('검색어를 입력하십시오.');
		sword01.addClass('wrong');
	}
	else {
		sword01.removeClass('wrong');
		$.ajax({ 
			type: "POST",
			url: _URL['default'] +"/_admin/execute/homeAjax.php",
			data: "method=member&exec=address&name="+ sword01.val(),
			dataType: 'json',
			success: function(rsltArray) {
				var resultArea = $("#popupResultArea");
				//alert(rsltArray)
				if (rsltArray) {
					resultArea.css("height", "150px");
					resultArea.css("minHeight", "150px");
					resultArea.css("overflow", "auto");
					resultArea.css("border", "1px solid #dcdcdc");
					resultArea.css("textAlign", "left");
					var newUlItem = "";
					for ( var key in rsltArray) {
						var addText = "- ["+ rsltArray[key]['zipcode'] +"] "+ rsltArray[key]['sido'] +" "+  rsltArray[key]['gugun'] +" "+  rsltArray[key]['dong'] +" "+  rsltArray[key]['ri'] +" "+  rsltArray[key]['bunji'];
						var addAddr = rsltArray[key]['sido'] +" "+  rsltArray[key]['gugun'] +" "+  rsltArray[key]['dong'] +" "+  rsltArray[key]['ri'];
						newUlItem += "<ul>";
						newUlItem += "<li class=\"cont\"> "+ addText +" ";
						newUlItem += "<input type=\"button\" class=\"butType\" style=\"text-align:middle;\" value=\"선택\" title=\"선택\" onclick=\"inputPopupVal('"+ rsltArray[key]['zipcode'] +"', '"+ addAddr +"')\" />";
						newUlItem += "</li>";
						newUlItem += "</ul>";
					}
					resultArea.html(newUlItem);
					
				}
				else {
					resultArea.css("textAlign", "center");
					resultArea.html("찾으시는 주소 정보가 없습니다.");
				}
			}
		});
	}
	return false;
}

function show(Inhtml){
	var alertForm = document.createElement("DIV");
	alertForm.title = "입력값 오류";
	alertForm.id = "alertForm";
	document.body.appendChild(alertForm);
	var textVal = document.createElement("P");
	alertForm.appendChild(textVal);
	textVal.innerHTML = error_str;
	$("#alertForm").dialog({
		bgiframe: true,
		modal: true,
		draggable: false ,
		resizable: false ,
		buttons: {
			확인: function() {
				$(this).dialog('close');
			}
		}
		,
		close: function() {
			$("#alertForm").dialog( 'destroy' ) ;
			document.body.removeChild(alertForm);
			if (focusing) {
				obj.focus();
			}
			if (classChange) {
				var tmpClass = obj.className;
				tmpClass = strReplace('text', 'wrong', tmpClass);
				obj.className = tmpClass;
			}
			if (selecting) {
				obj.select();
			}
		}
	});
}

/*12 -> 0012 처엄 0 채우기*/
function zeroFill(inputvalue,demandLength){
	inputvalue = "" + inputvalue;
	var spaceValue = "";
	for (var i = 0; i < demandLength-inputvalue.length;i++){
		spaceValue += "0";
	}
	return spaceValue+inputvalue;
}

/*12 -> 1200 처엄 0 채우기*/
function zeroFillEnd(inputvalue,demandLength){
	inputvalue = "" + inputvalue;
	var spaceValue = "";
	for (var i = 0; i < demandLength-inputvalue.length;i++){
		spaceValue += "0";
	}
	return inputvalue + spaceValue;
}

/* 메시지 박스 띄우기(반투명으로 화면을 가린 후) */
function showMessageObj(Inhtml){
	if ($("#messageBoxObj")) $("#messageBoxObj").remove();
	if ($("#blockContentsBox")) $("#blockContentsBox").remove();
	$('body').append("<div id=\"blockContentsBox\"></div>");
	$("#blockContentsBox").css('position', 'absolute');
	$("#blockContentsBox").css('top', '0');
	$("#blockContentsBox").css('left', '0');
	$("#blockContentsBox").css('width', $('body').width());
	$("#blockContentsBox").css('height', $('body').height()+22);
	var ifrmSrc = /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank';
	var ifStr = "<iframe name=\"blockFrame\" id=\"blockFrame\" src=\""+ ifrmSrc +"\" frameborder=\"0\" scrolling=\"no\" style=\"width:100%; height:100%; margin:0;background: #000000;\"></iframe>";
	$("#blockContentsBox").append(ifStr);
	$("#blockFrame").css('opacity',0.0);
	$("#blockContentsBox").css('z-index', '199');
	$("#blockContentsBox").css('background', '#000000');
	$("#blockContentsBox").css('opacity', '0.6');
	
	$('body').append("<div id=\"messageBoxObj\"></div>");
	$("#messageBoxObj").css('position', 'absolute');
	$("#messageBoxObj").css('border', '2px solid #7A88B3');
	$("#messageBoxObj").css('width', 'auto');
	$("#messageBoxObj").css('height', 'auto');
	$("#messageBoxObj").css('z-index', '200');
	$("#messageBoxObj").css('top', '50%');
	$("#messageBoxObj").css('left', '50%');
	$("#messageBoxObj").css('display', 'block');
	//alert(Inhtml)
	$("#messageBoxObj").html(Inhtml);
	var wWidth = $('#messageBoxObj').width();
	var wHeight = $('#messageBoxObj').height();
	var leftGap = parseInt((wWidth/2),10);
	var topGap = parseInt((wHeight/2),10);
	var scrollGap = document.documentElement.scrollTop;
	$("#messageBoxObj").css('margin-top', (-1*(topGap-scrollGap)));
	$("#messageBoxObj").css('margin-left', (-1*leftGap));
	$("#messageBoxObj").css('width', wWidth);
	$("#messageBoxObj").css('height', wHeight);
}

/* 띄운 메시지 박스만 없애기 */
function hideMessageObj() {
	$("#messageBoxObj").remove();
}

/* 띄운 메시지 박스와 반투명 화면 없애기 */
function clearMessageObj() {
	$("#messageBoxObj").remove();
	$("#blockContentsBox").remove();
}

/* 메시지 박스 띄우기(반두명으로 화면을 가리기 없음) */
function showMessageObjNon(Inhtml){
	if ($("#messageBoxObj")) $("#messageBoxObj").remove();
	if ($("#blockContentsBox")) $("#blockContentsBox").remove();
	$('body').append("<div id=\"blockContentsBox\"></div>");
	$("#blockContentsBox").css('position', 'absolute');
	$("#blockContentsBox").css('top', '50%');
	$("#blockContentsBox").css('left', '50%');
	$("#blockContentsBox").css('width', '100');
	$("#blockContentsBox").css('height', '100');
	var ifStr = "<iframe name=\"blockFrame\" id=\"blockFrame\" frameborder=\"0\" scrolling=\"no\" style=\"width:100%; height:100%; margin:0;background: #000000;\"></iframe>";
	$("#blockContentsBox").append(ifStr);
	$("#blockContentsBox").css('z-index', '199');
	$("#blockContentsBox").css('background', '#000000');
	$("#blockContentsBox").css('opacity', '1');
	
	$('body').append("<div id=\"messageBoxObj\"></div>");
	$("#messageBoxObj").css('position', 'absolute');
	$("#messageBoxObj").css('border', 'none');
	$("#messageBoxObj").css('width', 'auto');
	$("#messageBoxObj").css('height', 'auto');
	$("#messageBoxObj").css('z-index', '200');
	$("#messageBoxObj").css('top', '50%');
	$("#messageBoxObj").css('left', '50%');
	$("#messageBoxObj").css('display', 'block');
	//alert(Inhtml)
	$("#messageBoxObj").html(Inhtml);
	var wWidth = $('#messageBoxObj').width();
	var wHeight = $('#messageBoxObj').height();
	var leftGap = parseInt((wWidth/2),10);
	var topGap = parseInt((wHeight/2),10);
	var scrollGap = document.documentElement.scrollTop;
	$("#messageBoxObj").css('margin-top', (-1*(topGap-scrollGap)));
	$("#messageBoxObj").css('margin-left', (-1*leftGap));
	$("#messageBoxObj").css('width', wWidth);
	$("#messageBoxObj").css('height', wHeight);
	$("#blockContentsBox").css('margin-top', (-1*(topGap-scrollGap)));
	$("#blockContentsBox").css('margin-left', (-1*leftGap));
	$("#blockContentsBox").css('width', wWidth+0);
	$("#blockContentsBox").css('height', wHeight+0);
}


/* 메시지 박스 띄우기(반두명으로 화면을 가리기 없음) */
function showMessageObjNonPosition(Inhtml, posiX, posiY){
	$('body').append("<div id=\"messageBoxObj\"></div>");
	$("#messageBoxObj").css('position', 'absolute');
	$("#messageBoxObj").css('border', '2px solid #7A88B3');
	$("#messageBoxObj").css('z-index', '200');
	$("#messageBoxObj").css('display', 'block');

	$('#messageBoxObj').append("<div id=\"normalContentsBox\"></div>");
	$("#normalContentsBox").css('position', 'absolute');
	$("#normalContentsBox").css('width', 'auto');
	$("#normalContentsBox").css('height', 'auto');
	$("#normalContentsBox").css('z-index', '199');
	$("#normalContentsBox").html(Inhtml);
	var wWidth = $("#normalContentsBox").width();
	var wHeight = $("#normalContentsBox").height();
	$("#messageBoxObj").css('width', wWidth);
	$("#messageBoxObj").css('height', wHeight);

	$('#messageBoxObj').append("<div id=\"blockContentsBox\"></div>");
	var ifStr = "<iframe name=\"blockFrame\" id=\"blockFrame\" frameborder=\"0\" scrolling=\"no\" style=\"width:100%; height:100%; margin:0;background: #000000;\"></iframe>";
	$("#blockContentsBox").append(ifStr);
	$('#messageBoxObj').append("<div id=\"normalContentsBox\"></div>");
	$("#blockContentsBox").css('position', 'absolute');
	$("#blockContentsBox").css('top', '0');
	$("#blockContentsBox").css('left', '0');
	$("#blockContentsBox").css('width', wWidth+4);
	$("#blockContentsBox").css('height', wHeight+4);
	$("#blockContentsBox").css('z-index', '198');
	$("#blockContentsBox").css('background', '#000000');
	$("#blockContentsBox").css('opacity', '0.6');
	$("#messageBoxObj").css('top', posiX);
	$("#messageBoxObj").css('left', posiY);
}

function messageBoxPosi(Inhtml, posiX, posiY){
	if ($("#messageBoxObj")) $("#messageBoxObj").remove();
	if ($("#blockContentsBox")) $("#blockContentsBox").remove();
	$('body').append("<div id=\"blockContentsBox\"></div>");
	$("#blockContentsBox").css('position', 'absolute');
	$("#blockContentsBox").css('top', '0');
	$("#blockContentsBox").css('left', '0');
	$("#blockContentsBox").css('width', $('body').width());
	$("#blockContentsBox").css('height', $('body').height()+22);
	var ifStr = "<iframe name=\"blockFrame\" id=\"blockFrame\" frameborder=\"0\" scrolling=\"no\" style=\"width:100%; height:100%; margin:0;background: #000000;border:none;\"></iframe>";
	$("#blockContentsBox").append(ifStr);
	$("#blockContentsBox").css('z-index', '199');
	$("#blockContentsBox").css('background', '#000000');
	$("#blockContentsBox").css('opacity', '0.0');
	
	$('body').append("<div id=\"messageBoxObj\"></div>");
	$("#messageBoxObj").css('position', 'absolute');
	$("#messageBoxObj").css('border', 'none');
	$("#messageBoxObj").css('width', 'auto');
	$("#messageBoxObj").css('height', 'auto');
	$("#messageBoxObj").css('z-index', '200');
	$("#messageBoxObj").css('top', '0');
	$("#messageBoxObj").css('left', '0');
	$("#messageBoxObj").css('display', 'block');
	//alert(Inhtml)
	$("#messageBoxObj").html(Inhtml);
	var wWidth = $('#messageBoxObj').width();
	var wHeight = $('#messageBoxObj').height();
	$("#messageBoxObj").css('top', posiY);
	$("#messageBoxObj").css('left', posiX);
	$("#messageBoxObj").css('width', wWidth);
	$("#messageBoxObj").css('height', wHeight);
	$("#blockFrame").css('top', posiY);
	$("#blockFrame").css('left', posiX);
	$("#blockFrame").css('width', wWidth);
	$("#blockFrame").css('height', wHeight);
	$("#blockContentsBox").click( function () {
		clearMessageObj();
	});
}

/* 띄운 메시지 박스만 없애기 */
function hidePopObj() {
	PopObj.style.position = "absolute";
	PopObj.style.top = "0";
	PopObj.style.left = "0";
	PopObj.innerHTML = "";
	PopObj.style.marginTop = "0";
	PopObj.style.marginLeft = "0";
	PopObj.style.zIndex = "1";
	PopObj.style.display = "none";
	PopObj = null;
}

function fullmenutab1(tab) {
	if (tab == 'fullmenutab1') {
		var src01 = strReplace('_off', '_on', $('#fullmenutabimg0').attr('src'));
		var src02 = strReplace('_on', '_off', $('#fullmenutabimg1').attr('src'));
		$('#fullmenutabimg0').attr('src', src01);
		$('#fullmenutabimg1').attr('src', src02);
		$('#fullmenutab1').css('display', 'block');
		$('#fullmenutab2').css('display', 'none');
	}
	else {
		var src01 = strReplace('_on', '_off', $('#fullmenutabimg0').attr('src'));
		var src02 = strReplace('_off', '_on', $('#fullmenutabimg1').attr('src'));
		$('#fullmenutabimg0').attr('src', src01);
		$('#fullmenutabimg1').attr('src', src02);
		$('#fullmenutab1').css('display', 'none');
		$('#fullmenutab2').css('display', 'block');
	}
}

/* 레프트메뉴 롤오버 함수 */
var originPosition = 0;
var originAxis = null;
function rollOver(obj, size, axis) {
	if(appName == "Microsoft Internet Explorer") {
		originAxis = axis;
		if (axis == "X") {
			var bgPositionX = "";
			var bgPositionY = "";
			if (obj.currentStyle) {
				bgPositionX = obj.currentStyle["backgroundPositionX"];
				bgPositionY = obj.currentStyle["backgroundPositionY"];
			}
			originPosition = bgPositionY;
			obj.style.backgroundPosition = bgPositionX +" 0px ";
	//alert()
		}
		else {
			var bgPositionX = "";
			var bgPositionY = "";
			if (obj.currentStyle) {
				bgPositionX = obj.currentStyle["backgroundPositionX"];
				bgPositionY = obj.currentStyle["backgroundPositionY"];
			}
			originPosition = bgPositionX;
			//alert(obj.currentStyle["backgroundPositionY"]);
			obj.style.backgroundPosition = " -"+ size +"px "+ bgPositionY;
		}
	}
	else {
		originAxis = axis;
		if (axis == "X") {
			var bgPositionX = "";
			var bgPositionY = "";
			if (window.getComputedStyle) {
				var computedStyle = document.defaultView.getComputedStyle(obj,null);
				var propertyValue = computedStyle.getPropertyValue("background-position");
				var bgPositiontmp = strReplace("px", "", propertyValue);
				var bgPosition = bgPositiontmp.split(" ");
				bgPositionX = parseInt(bgPosition[0],10);
				bgPositionY = parseInt(bgPosition[1],10);
			}
			originPosition = bgPositionY;
			obj.style.backgroundPosition = bgPositionX +"px 0px ";
		}
		else {
			var bgPositionX = "";
			var bgPositionY = "";
			if (window.getComputedStyle) {
				var computedStyle = document.defaultView.getComputedStyle(obj,null);
				var propertyValue = computedStyle.getPropertyValue("background-position");
				var bgPositiontmp = strReplace("px", "", propertyValue);
				var bgPosition = bgPositiontmp.split(" ");
				bgPositionX = parseInt(bgPosition[0],10);
				bgPositionY = parseInt(bgPosition[1],10);
			}
			originPosition = bgPositionX;
			obj.style.backgroundPosition = " -"+ size +"px "+ bgPositionY +"px";
		}
	}
}
function rollOut(obj) {
	if(appName == "Microsoft Internet Explorer") {
		if (originAxis == "X") {
			var bgPositionX = "";
			if (obj.currentStyle) {
				bgPositionX = obj.currentStyle["backgroundPositionX"];
			}
			obj.style.backgroundPosition = bgPositionX +" "+ originPosition;
		}
		else {
			var bgPositionY = "";
			if (obj.currentStyle) {
				bgPositionY = obj.currentStyle["backgroundPositionY"];
			}
			obj.style.backgroundPosition = originPosition +" "+ bgPositionY;
		}
	}
	else {
		if (originAxis == "X") {
			var bgPositionX = "";
			if (window.getComputedStyle) {
				var computedStyle = document.defaultView.getComputedStyle(obj, null);
				var propertyValue = computedStyle.getPropertyValue("background-position");
				var bgPositiontmp = strReplace("px", "", propertyValue);
				var bgPosition = bgPositiontmp.split(" ");
				bgPositionX = parseInt(bgPosition[0], 10);
			}
			obj.style.backgroundPosition = bgPositionX +"px "+ originPosition +"px";
		}
		else {
			var bgPositionY = "";
			if (window.getComputedStyle) {
				var computedStyle = document.defaultView.getComputedStyle(obj,null);
				var propertyValue = computedStyle.getPropertyValue("background-position");
				var bgPositiontmp = strReplace("px", "", propertyValue);
				var bgPosition = bgPositiontmp.split(" ");
				bgPositionY = parseInt(bgPosition[1],10);
			}
			obj.style.backgroundPosition = originPosition +"px "+ bgPositionY +"px";
		}
	}
}

