﻿/*-----------------------------------------------
	incremental.js  -  2008/11/19
-----------------------------------------------*/
function xmlHTTP_Open(fileName, targetName){
	var xmlhttp = xmlHTTP_Create();
	if (xmlhttp) {
		xmlhttp.open('GET', fileName+chkGetParam());
		xmlhttp.onreadystatechange = function() {
			if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				setInnerHTML(targetName,xmlhttp.responseText);
			}
		}
	xmlhttp.send('');
	}
}

function chkGetParam(){
var now = new Date();
var res = new Array();
var Obj = new Array(
	document.getElementById('type'),
	document.getElementById('cid_1st'),
	document.getElementById('cid_2nd'),
	document.getElementById('code_name'),
	document.getElementById('maker'),
	document.getElementById('price'),
	document.getElementById('freeword')
);
	for(var i=0; i < Obj.length; i++){
		if(Obj[i].value != ""){
			res[i] = Obj[i].name + "=" + 
					 encodeURI(Obj[i].value);
		}
	}
	if(res.length > 0){
		return "?"+res.join('&')+"&addtion="+ now.getSeconds() + now.getMilliseconds();
	}else{
		return '';
	}
}

function change1stCtgry(baseURL){
	document.getElementById('cid_2nd').value = "";
	xmlHTTP_Open(baseURL + 'ans2ndCtgrySelect2.php', 'ctgry2ndSelectSRC');
	xmlHTTP_Open(baseURL + 'ansIncremental.php', 'resultSRC');
}
function sendUsersLog(fileName){
		var xmlhttp2 = xmlHTTP_Create();
		if (xmlhttp2) {
			xmlhttp2.open('GET', fileName+chkGetParam());
		xmlhttp2.send('');
		}
}
//-----------------------------------------------
