                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   /****************************************************************************
*
*	$Id$
*
*	作成日：2005/03/22
*
*****************************************************************************
*
*	更新日：
*	更新内容：
*
*
****************************************************************************/

<!--

var allinput;

/*********************************************
* 正の数値かどうかチェックします。
*
* @param フォームオブジェクト
*
*********************************************/
function isNum(obj){
	var txt = obj.value;
	var data = txt.match(/[^0-9]/g);
	return !data;
}


/*********************************************
* スペースどうかチェックします。
*
* @param フォームオブジェクト
* @return スペースのみ:true スペース以外:false
*
*********************************************/
function isSpace(obj){
    var str = obj.value;
    var i;
    
    if(str == "" || str == null || str == "	"){
    	return true;
    }
    
    for(i = 0; i < str.length; i++){
    	if(str.substr(i,1) != " " && str.substr(i,1) != "　" && str.substr(i,1) != "	"){
            return false;
        }
    }
    return true;
}


/*********************************************
* 指定した小数点位置を四捨五入します。
*
* @param 対象数値
* @param 四捨五入桁(正の整数：小数位置　負の整数：整数位置　0：何もしない)
* @return 概算値
*
*********************************************/
/* This script is Copyright (c) Paul McFedries and 
Logophilia Limited (http://www.mcfedries.com/).
Permission is granted to use this script as long as 
this Copyright notice remains in place.*/

function decify(original_number, decimals) {
	var d;
	var result1;
	var result2;
	var result3;
	var result;
	
	if(decimals > 0){
		d = eval(decimals) - 1;
		result1 = original_number * Math.pow(10, d);
		result2 = Math.round(result1);
		result3 = result2 / Math.pow(10, d);
		result = pad_with_zeros(result3, d);
			
	}else if(decimals == 0){
		result = pad_with_zeros(original_number, d);
		
	}else{

		d = eval(decimals) * -1;
		result1 = original_number / Math.pow(10, d);
		result2 = Math.round(result1);
		result = result2 * Math.pow(10, d);

	}
	
	return result;
}

function pad_with_zeros(rounded_value, decimal_places) {

	// Convert the number to a string
	var value_string = rounded_value.toString();
    
	// Locate the decimal point
	var decimal_location = value_string.indexOf(".");

	// Is there a decimal point?
	var decimal_part_length;
	if (decimal_location == -1) {
        
		// If no, then all decimal places will be padded with 0s
		decimal_part_length = 0;
        
        // If decimal_places is greater than zero, tack on a decimal point
        value_string += decimal_places > 0 ? "." : "";
        
    }else {

		// If yes, then only the extra decimal places will be padded with 0s
		decimal_part_length = value_string.length - decimal_location - 1;
	}
    
	// Calculate the number of decimal places that need to be padded with 0s
	var pad_total = decimal_places - decimal_part_length;
    
	if (pad_total > 0) {
        
		// Pad the string with 0s
		for (var counter = 1; counter <= pad_total; counter++){
            value_string += "0";
		}
	}
	
    return value_string;
}


/*********************************************
* 3桁区切りにします。
*
* @param 対象数値
* @param 表示桁数(0以外を指定した場合は、小数第2位まで表示)
* @param 通貨マーク
* @param 通貨マーク表示位置(0:先頭 1:末尾)
* @return 表示数値
*
*********************************************/
/*
 *This JavaScript takes an input number and adds commas in the proper places.
 *As needed by its original purpose, also adds a dollar.
 *Copyright 1998, David Turley <dturley@pobox.com>
 *Feel free to use and build on this code as long as you include this notice.
 *
 *Code Modified by Jason Gould jagould@cisco.com
 *Added parameters which removed dependance on HTML form, optional boolean for trailing decimals
 *Last Modified September 11, 2000
*/

function commify(Num2,deci,mark,position) {
	var Num = Num2.toString();
	var newNum = "";
	var newNum2 = "";
	var count = 0;

	if (deci == null) {
		deci = 1;
	}
    if(mark == null){
    	mark = "&yen;";
    }
    if(position == null){
    	position = 0;
    }
	//check for decimal number
	if (Num.indexOf('.') != -1){  //number ends with a decimal point
		if (Num.indexOf('.') == Num.length-1){
			Num += "00";
		}
		if (Num.indexOf('.') == Num.length-2){ //number ends with a single digit
			Num += "0";
		}
        
		var a = Num.split("."); 
		Num = a[0];				//the part we will commify
		var end = a[1];			//the decimal place we will ignore and add back later
		
	}else {
		var end = "00";
	} 
 
	//this loop actually adds the commas   
	for (var k = Num.length-1; k >= 0; k--){
		var oneChar = Num.charAt(k);
		if (count == 3){
			newNum += ",";
			newNum += oneChar;
			count = 1;
			continue;
			
		}else {
			newNum += oneChar;
			count ++;
		}
	}  //but now the string is reversed!
   
	//re-reverse the string
	for (var k = newNum.length-1; k >= 0; k--){
		var oneChar = newNum.charAt(k);
		newNum2 += oneChar;
	}
	// add currency sign and decimal ending from above
	if(position == "0"){
		newNum2 = mark + newNum2;
	}else{
		newNum2 = newNum2 + mark;
	}
	
	if (deci != "0") {
		newNum2 += "." + end;
	}
	return newNum2;

}


/*********************************************
* パラメータを取得します。
*
*
*********************************************/
function doGet() {
	var data=location.toString().split('?');
	
	if(data.length == 1){
		return;
	}

	data[1]=data[1].replace(/#.*/,'');
	data[1]=data[1].replace(/\%2C/,',');
	data[1]=data[1].replace(/\+/,' ');
//	data[1]=data[1].replace(0,'');
	data[1]=data[1].replace(/\%24/,'$');
	data[1]=data[1].replace(/\%2F/,'/');
	data[1]=data[1].replace(/\%3F/,'?');
	data[1]=data[1].replace(/\%23/,'#');
	allinput=data[1].split('&');   

}


/*********************************************
* キーから値を取得します。
*
* @param キー
* @return 値
*
*********************************************/
function getVal(name) {
	var thisvar;
	for (i=0; i<allinput.length; i++) {
		thisvar = allinput[i].split('=');
		for (j=0; j<2; j++) {
			thisvar[j] = thisvar[j].replace(/\%3D/,'=');
			thisvar[j] = thisvar[j].replace(/\%25/,'%');
		}
		if (thisvar[0] == name) {
			return(thisvar[1]);
		}
	}
	return(null);
}


/*********************************************
* サブウィンドウを開きます。
*
* @param URL
* @param ウィンドウ名
* @param 属性
*
*********************************************/
function openWindow(theURL, winName, features) {
	pixWindow = window.open(theURL,winName,features)   
}

//-->

