function hideInfoCrearForm(m_message,m_email) {
	if ( document.getElementById('info') ) {
		document.forms['quick_form'].elements.q_message.value 	= m_message;
		document.forms['quick_form'].elements.q_email.value 	= m_email;
		document.getElementById('info').style.display 			= "none";
	}
}

function makeGray (obj, state, text){
	if (state && (obj.value == '')){
		obj.value = text;
	} else if (!state && (obj.value == text)){
		obj.value = '';
	}
}


function changeDisplayById(objId){
	for (c = 0; c < changeDisplayById.arguments.length; c++){
		obj = document.getElementById(changeDisplayById.arguments[c]);
		if (obj.style.display == 'none') obj.style.display = 'block';
		else obj.style.display = 'none';
	}
}

function gotoURL(url, target, callback){

	if (!url) url = "/";

	if(typeof callback == "function")
		callback(url);

	if(target && target!='_self'){
		popupURL(url, target);
	}
	else{
		if (window.event){
			var src = window.event.srcElement;
			if((src.tagName != 'A') && ((src.tagName != 'IMG') || (src.parentElement.tagName != 'A'))){
				if (window.event.shiftKey) window.open(url);
				else document.location = url;
			}
		} else document.location = url;
	}
}


function popupURL(url, target){
	window.open(url, target);
}

function getLeftPos(obj){
	var res = 0;
	while (obj){
		res += obj.offsetLeft;
		obj = obj.offsetParent;
	}
	return res;
}

function getTopPos(obj){
	var res = 0;
	while (obj){
		res += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return res;
}

function chbCheckAll(formObj, checkName, checkVal){
	var el = formObj.elements;
	for (count = 0; count < el.length; count++)
		if (el[count].name == checkName + '[]')
			if (!el[count].disabled) el[count].checked = checkVal;
}

function chbExamAll(formObj, checkName, resName){
	var checkCount = 0;
	var boxCount = 0;
	var el = formObj.elements;
	for (count = 0; count < el.length; count++)
		if (el[count].name == checkName + '[]'){
			boxCount++;
			if (el[count].checked || el[count].disabled) checkCount++;
		}
	formObj.elements[resName].checked = (checkCount == boxCount);
}

function chbIsAllEmpty(formObj, checkName){
	var checkCount = 0;
	var boxCount = 0;
	var el = formObj.elements;
	for (count = 0; count < el.length; count++)
		if (el[count].name == checkName + '[]'){
			boxCount++;
			if (el[count].checked) checkCount++;
		}
	return(checkCount == 0);
}

function chbIsOnlyOne(formObj, checkName){
	var checkCount = 0;
	var boxCount = 0;
	var el = formObj.elements;
	for (count = 0; count < el.length; count++){
		if (el[count].name == checkName + '[]'){
			boxCount++;
			if (el[count].checked) checkCount++;
		}
	}
	return(checkCount == 1);
}

function disableAll(){
	for (c1 = 0; c1 < document.forms.length;  c1++){
		var formElements = document.forms[c1].elements;
		for (c2 = 0; c2 < formElements.length;  c2++) formElements[c2].disabled = true;
	}
}

// name - cookie name
// value - cookie value
// [expires] - Date object (by default cookie expires at the end of browser session)
// [path]
// [domain]
// [secure]
function setCookie(name, value, expires, path, domain, secure)
{
	var curCookie = name + "=" + escape(value) +
                ((expires) ? "; expires=" + expires.toGMTString() : "") +
                ((path) ? "; path=" + path : "") +
                ((domain) ? "; domain=" + domain : "") +
                ((secure) ? "; secure" : "")

	if ( (name + "=" + escape(value)).length <= 4000)
		document.cookie = curCookie
}

// name - cookie name
function getCookie(name)
{
        var prefix = name + "="
        var cookieStartIndex = document.cookie.indexOf(prefix)
        if (cookieStartIndex == -1)
                return null
        var cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)
        if (cookieEndIndex == -1)
                cookieEndIndex = document.cookie.length
        return unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))
}

// name - cookie name
// [path]
// [domain]
function deleteCookie(name, path, domain)
{
	if (getCookie(name))
	{
		document.cookie = name+"="+
                ((path) ? "; path=" + path : "") +
                ((domain) ? "; domain=" + domain : "") +
                "; expires=Thu, 01-Jan-70 00:00:01 GMT"
	}
}


function preLoad() {
	if(document.images)  {
		var argLen = arguments.length;
		for(var i = 0; i < argLen; i++) {
			var arg = arguments[i];
			self[arg] = new Image();
			self[arg].src = arg;
		}
	}
}

function ch_img(obj, img ) {
	if (self[img]) {
		obj.src = self[img].src;
	}
}

function mm_act(obj,img,cl,num,selected){
	
	if ( cl == 'item act' )
		showMenu(obj, num);
	else
		hideMenu(obj, num);
	
	if ( selected ) return;
	
	while (obj) {
		obj = obj.childNodes[0];
		if ( obj && obj.tagName == 'IMG') {
			ch_img(obj,img);
			break;
		}
	}
	
	while (obj && cl!='') {
		obj = obj.parentNode;
		if ( obj && obj.tagName == 'DIV') {
			obj.className = cl;
			break;
		}
	}
}

function popup_view (url, w, h, wname) {
	scr_left = 0;
	scr_top = 0;
	wname = wname;
	new_window = window.open (url, wname , "title=image,location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,width="+w+",height="+h+",top="+scr_top+",left="+scr_left);
	new_window.focus();
	return new_window;
}

/////////////////////////////
function check_form(){

if(document.quote_formm.fname.value == ""){
	alert('Please Enter First Name.');
	document.quote_formm.fname.focus();
	return false;
}
if(document.quote_formm.lname.value == ""){
	alert('Please Enter Last Name.');
	document.quote_formm.lname.focus();
	return false;
}

if(document.quote_formm.country.value == ""){
	alert('Please Select Country.');
	document.quote_formm.country.focus();
	return false;
}

if(document.quote_formm.phone.value == ""){
	alert('Please Enter Phone Number.');
	document.quote_formm.phone.focus();
	return false;
}

/*if(isNaN(document.quote_formm.phone.value)){
	alert('Please Enter Correct Phone Number.');
	document.quote_formm.phone.value = '';
	document.quote_formm.phone.focus();
	return false;
}
*/
if(document.quote_formm.email.value == ""){
	alert('Please Enter Email.');
	document.quote_formm.email.focus();
	return false;
}
if(document.quote_formm.email.value != "" && document.quote_formm.email.value.indexOf('@')==-1 || document.quote_formm.email.value.indexOf('.')==-1)
{
	alert("Please Enter Valid Email ID.!");
	document.quote_formm.email.value = ""
	document.quote_formm.email.focus();
	return false;
}

if(document.quote_formm.description.value == ""){
	alert('Please Enter Description.');
	document.quote_formm.description.focus();
	return false;
}

}

