function openbox(id){ 
	var display = document.getElementById(id).style.display;
	if(display=='none'){
		document.getElementById(id).style.display='block';
	}
	else
	{
		document.getElementById(id).style.display='none';
	}
}

function change_style(id, first_class, second_class){
	if(document.getElementById(id).className==first_class){
		document.getElementById(id).className=second_class;
	}
	else
	{
		document.getElementById(id).className=first_class;
	}
}

function tip(){
	this.show = function(text, x, y){
		var div = document.createElement("div");
		div.className = 'tip';
		div.id = 'mark';
		div.innerHTML = text;
	
		var xcoordinate = x+10;
		var ycoordinate = y+20;
		div.style.left = xcoordinate + 'px';
		div.style.top = ycoordinate + 'px';
		document.body.appendChild(div);
	}
	this.hide = function(){
		var mark = document.getElementById('mark');
		mark.parentNode.removeChild(mark);
	}
	this.getX = function(id)
	{
		var obj = document.getElementById(id);
	  	var x = 0; 
      	while(obj) { 
            x += obj.offsetLeft; 
            obj = obj.offsetParent; 
      	}
      	return x;
	}
	this.getY = function(id)
	{
		var obj = document.getElementById(id);
		var y = 0; 
      	while(obj) { 
            y += obj.offsetTop; 
            obj = obj.offsetParent; 
      	} 
      	return y;
	}
}
var helpbox = new tip();

function checkemail(id){

	var a = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.[a-zA-Z]{2,4})+$/;
	var mail = document.getElementById(id);
	var result = mail.value.search(a);
	
	if(result == 0) {
		mail.style.background = "#2AFF00";
		status = true;
	}
	else
	{
		mail.style.background = "#FF2A00";
		status = false;
	}
	checking();
}

function checkbox_submit(object_name, id) {
    document.advanced_search[object_name][id].checked = document.advanced_search[object_name][id].checked ? false : true;
    document.forms['advanced_search'].submit();
}
