// JavaScript Document


function selectOptionByValue(selectElementName,optionValue){

	var obj = getOptionByValue(selectElementName,optionValue);
	
	if(obj != null){	
		obj.selected = true;
	}

}

function getOptionByValue(selectElementName,optionValue){

	var obj_all = document.getElementById(selectElementName).options;
	

	for(i = 0 ; i < obj_all.length ; i++){
	
		if(obj_all[i].value == optionValue){
		
			return obj_all[i];
		
		}
	
	}
	
	
	return null;

}




function getOptionIndexByValue(selectElementName,optionValue){

	var obj_all = document.getElementById(selectElementName).options;

	for(i = 0 ; i < obj_all.length ; i++){
	
		if(obj_all[i].value == optionValue){
		
			return i;
		
		}
	
	}
	
	
	return -1;

}





function getOffsetLeft(obj){

var element;
var sum = 0;

	sum = obj.offsetLeft;
	
	while(obj = obj.offsetParent){
		sum = sum + obj.offsetLeft;
	}
	
	return sum;

}




function getOffsetTop(obj){

var element;
var sum = 0;

	sum = obj.offsetTop;
	
	while(obj = obj.offsetParent){
		sum = sum + obj.offsetTop;
	}
	
	return sum;

}