
function setBackImage(element, imageURL) {
	document.getElementById(element).style.backgroundImage = 'url('+ imageURL +')';
	//document.getElementById(element).style.backgroundPosition = '0px 0px';
	//document.getElementById(element).style.color = '#CF0021';
}
function unsetBackImage(element) {
	document.getElementById(element).style.backgroundImage = 'none';
	//document.getElementById(element).style.color = '#000000';
}

function setClass(element, classname) {
	document.getElementById(element).style.className = classname;
}


function optionHighlight(div,classname) {	
	var cell = document.getElementById(div);
	toggleClass(cell,classname);
}

function optionDefault(div,classname) {
	var cell = document.getElementById(div);
	toggleClass(cell,classname);
}

function isClass(target,className) {
	if (!target.className) {
		return false;
	}
	if (isType(className,STRING)) {
		return target.className.indexOf(className) > -1;
		
	} else if (isType(className,OBJECT)) {
		for (var i = 0; i < className.length; i++) {
			if (target.className.indexOf(className[i]) > -1) {
				return true;
			}
		}
	}
	
	return false;
}

function addClass(target,k) {
	var cn = target.className;
	if (cn && cn.indexOf(k) > -1) {
		return;
	}
	if (cn && cn.length > 0) {
		k = SPACE + k;
		cn += k;
	} else {
		cn = k;
	}
	target.className = cn;
}

function removeClass(target,k) {
	var cn = target.className;
	var index;
	
	if (!cn) {
		return;
	}
	cn = trim(cn);
	if ((index = cn.indexOf(k)) > -1) {
		cn = cn.substring(0,index)+cn.substring(index+k.length);
	}
	
	target.className = cn;
}

function toggleClass(target,k) {
	if (isClass(target,k)) {
		removeClass(target,k);
	} else {
		addClass(target,k);
	}	
}

function getURL(URL) {
	window.location.href=URL;
}

function cleanState(id) {
	var state;	
	state = document.getElementById(id);	
	
	if (state.value == "First Name")
    {	  	  	
        state.value = "";
    }

	if (state.value == "Last Name")
	  {	  	  	
	  	state.value = "";
	  }
	
	if (state.value == "Company")
	  {	  	  	
	  	state.value = "";
	  }
	
	  
	  if (state.value == "Address")
	  {	  	  	
	  	state.value = "";
	  }
	  
	  if (state.value == "City")
	  {	  	  	
	  	state.value = "";
	  }
	  
	  if (state.value == "State")
	  {	  	  	
	  	state.value = "";
	  }
	  
	  if (state.value == "Phone/Mobile")
	  {	  	  		  	
		state.value = "";		
	  }
	  
	  if (state.value == "Email")
	  {	  	  	
	  	state.value = "";
	  }
	  
	  if (state.value == "Comments")
	  {	  	  	
	  	state.value = "";
	  }
	
	state.style.color = "#3a3737";
	state.style.fontWeight = "bold";
}

function changeState(id) {
	var state;	
	state = document.getElementById(id);	
	
    if(id == 'first_name_id'){
        if(!(state.value))
        {
            state.value = "First Name";
            state.style.fontWeight = "regular";
        }
    }
    
    if(id == 'last_name_id'){
        if(!(state.value))
        {
            state.value = "Last Name";
        }
    }
    
    if(id == 'firm'){
        if(!(state.value))
        {
            state.value = "Company";
        }
    }
    
    if(id == 'address'){
        if(!(state.value))
        {
            state.value = "Address";
        }
    }
    
    if(id == 'city'){
        if(!(state.value))
        {
            state.value = "City";
        }
    }
    
    if(id == 'state'){
        if(!(state.value))
        {
            state.value = "State";
        }
    }
    
     if(id == 'contact_no'){
        if(!(state.value))
        {
            state.value = "Phone/Mobile";
        }
    }
    
    if(id == 'email'){
        if(!(state.value))
        {
            state.value = "Email";
        }
    }
    
    if(id == 'comments'){
        if(!(state.value))
        {
            state.value = "Comments";
        }
    }

	state.style.color = "#3a3737";
	state.style.fontWeight = "bold";
}

