function addLoadEvent(func)
{
	var oldonload = window.onload;
	if (typeof window.onload != 'function')
		window.onload = func;
	else
	{
		window.onload = function()
		{
			if (oldonload) oldonload();
			func();
		}
	}
}


function Set_Cookie( name, value, expires, path, domain, secure )
{
	// set time, it's in milliseconds
	var today = new Date();
	today.setTime( today.getTime() );

	/*
	if the expires variable is set, make the correct
	expires time, the current script below will set
	it for x number of days, to make it for hours,
	delete * 24, for minutes, delete * 60 * 24
	*/
	if ( expires )
	{
	expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );

	document.cookie = name + "=" +escape( value ) +
	( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
	( ( path ) ? ";path=" + path : "" ) +
	( ( domain ) ? ";domain=" + domain : "" ) +
	( ( secure ) ? ";secure" : "" );
}

// this deletes the cookie when called
function Delete_Cookie( name, path, domain )
{
	if ( Get_Cookie( name ) ) document.cookie = name + "=" +
	( ( path ) ? ";path=" + path : "") +
	( ( domain ) ? ";domain=" + domain : "" ) +
	";expires=Thu, 01-Jan-1970 00:00:01 GMT";
}

function getFlashMovieObject(movieName)
{
  if (window.document[movieName])
  {
      return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
    {
      return document.embeds[movieName];
    }
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}

// this function gets the cookie, if it exists
function Get_Cookie( name )
{
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) &&
	( name != document.cookie.substring( 0, name.length ) ) )
	{
	return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ";", len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
function checkPhone(str)
{
	rePhoneNumber = new RegExp(/^[0-9]{0,3}\s?\-?\s?[0-9]{7,10}$/);
	if (!rePhoneNumber.test(str))
		return false;

	return true;

}

function checkEmail(str) {
///// function for validating email address
		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)

		if (str.indexOf(at)==-1){
		    return false
		} else if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		    return false
		} else 	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		} else  if (str.indexOf(at,(lat+1))!=-1){
		    return false
		} else 	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		   return false
		} else  if (str.indexOf(dot,(lat+2))==-1){
		    return false
		} else if (str.indexOf(" ")!=-1){
		     return false
		} else {
 		 	return true
 		}
}

function checkMultipleEmail(emails, split_char)
{
	emails_array = emails.split(split_char);
	checkStatus = true;
	for (e in emails_array)
	{
		if (trim(emails_array[e]) != "" && !checkEmail(trim(emails_array[e])))
			checkStatus =false;
	}
	return checkStatus;
}

function checkML(emailValue)
{
	if(!checkEmail(emailValue))
	{
		alert (_tpl_emailNotValid);
		document.joinML.focus();
		return false;
	} else {
		var url = "xmlJoinML.php?joinML_email="+emailValue+"&siteLang="+siteLang;
		var xml = LoadXML(url);
		if(xml != null)
		{
			var message = xml.getElementsByTagName('rsp')[0].firstChild.data;
			alert(message);
			var response = xml.getElementsByTagName('rsp_stat')[0].firstChild.data;
			if (response)
				document.joinML.reset();
			else
				document.joinML.focus();
		}
		return false;
	}
}

function getHTTPObject()
{
	try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) {}
	try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {}
	try { return new XMLHttpRequest(); } catch(e) {}
	alert("XMLHttpRequest not supported");
	return null;
 }

function LoadHTML(url)
{

	var xmlHttp = getHTTPObject();
	xmlHttp.open("GET",url, false);
	xmlHttp.onreadystatechange = function()
	{
		   if (xmlHttp.readyState != 4)  { return; }
		   var serverResponse = xmlHttp.responseText;

	}
	xmlHttp.send(null);
	return xmlHttp.responseText;
}
function LoadXML(url)
{
	var xmlHttp = getHTTPObject();
	xmlHttp.open("GET",url, false);
	xmlHttp.onreadystatechange = function()
	{
		   if (xmlHttp.readyState != 4)  { return; }
		   var serverResponse = xmlHttp.responseText;
	};
	xmlHttp.send(null);
	return xmlHttp.responseXML.documentElement;
}

// bulid string with the form values, fobj the form object, valFunc is validate function
function getFormValues(fobj)
{
   var str = "";
   var valueArr = null;
   var val = "";
   var cmd = "";

   for(var i = 0;i < fobj.elements.length;i++)
   {
       switch(fobj.elements[i].type)
       {
      	case "text":
           case "hidden":
           case "textarea":
           	str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
           break;

           case "radio":
           case "checkbox":
               if(fobj.elements[i].checked)
               		str += fobj.elements[i].name + "=" + escape(fobj.elements[i].value) + "&";
           break;

           case "select-one":
                str += fobj.elements[i].name + "=" + fobj.elements[i].options[fobj.elements[i].selectedIndex].value + "&";
           break;
       }
   }

   str = str.substr(0,(str.length - 1));
   return str;
}

// validate is got the validate function, if false then skip the validation
function submitAjaxForm(f,url)
{
   var str = getFormValues(f);
   xmlReq = postAjaxForm(url ,str);

 }

 function postAjaxForm(url,str)
{
   var doc = null
   if (typeof window.ActiveXObject != 'undefined' )
   {
       doc = new ActiveXObject("Microsoft.XMLHTTP");

   }
   else
   {
       doc = new XMLHttpRequest();
       doc.onload = displayState;
   }

   doc.open( "POST", url, true );
   doc.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
   doc.send(str);
   return doc.responseXML.documentElement;
}

function showMessage(message, elementID)
{
	document.getElementById(elementID).innerText=message;
}

function clearMessage(elementID)
{
	document.getElementById(elementID).innerText="";
}


function IsNumeric(sText)
{
   var ValidChars = "0123456789.- ";
   var IsNumber=true;
   var Char;


   for (i = 0; i < sText.length && IsNumber == true; i++)
      {
      Char = sText.charAt(i);
      if (ValidChars.indexOf(Char) == -1)
         {
         IsNumber = false;
         }
      }
   return IsNumber;
 }

function trim(strText) {
/// TRIM STRING FUNCTION
    // this will get rid of leading spaces
    while (strText.substring(0,1) == ' ')
        strText = strText.substring(1, strText.length);
    // this will get rid of trailing spaces
    while (strText.substring(strText.length-1,strText.length) == ' ')
        strText = strText.substring(0, strText.length-1);
   return strText;
}

function escapeString(sString)
{
// DETECT WHAT TO PUT STRING IN FOR HTML FORM ( ' OR " ) DEPANDING ON STRING CONTENTS
	if (sString.indexOf("'") == -1)
		valSep = "'";
	else
		valSep = '"';
	return valSep+sString+valSep;
}

function replaceSubstring(inputString, fromString, toString) {
 // GOES THROUGH THE INPUTSTRING AND REPLACES EVERY OCCURRENCE OF FROMSTRING WITH TOSTRING
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      // Find a string that doesn't exist in the inputString to be used
      // as an "inbetween" string
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } // Keep on going until we build an "inbetween" string that doesn't exist
      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      // Next, replace the "inbetween" string with the "toString"
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } // Ends the check to see if the string being replaced is part of the replacement string or not
   return temp; // Send the updated string back to the user
}

function popupWin(popUrl, width, height)
{
	if (!navigator.appName.indexOf("Microsoft")) width+=20;
	height+=5;
	topVar=((screen.height / 2)-(height/2));
	leftVar=((screen.width / 2)-(width/2));
	window.open(popUrl, "PopUp", "height="+height+", width="+width+", top="+topVar+", left="+leftVar+", scrollbars=auto, status=no, location=no, resize=yes, menubar=no, titlebar=no, toolbar=no");
}

function switchElementDisplay(elementID){
// SWITCH SELECTED ELEMENT DISPLAY: NONE/INLINE
	if (document.getElementById(elementID).style.display=="none")
		document.getElementById(elementID).style.display="inline";
	else
		document.getElementById(elementID).style.display="none";
}

function check_fields_architects(f)
{
	//return true;
	var fields_array=new Array("firstName","lastName","officeName", "officeAddress", "email");
	for (i=0;i<fields_array.length;i++)
	{
		if (f[fields_array[i]].value=="")
		{
			cMessage = eval("_alert_"+fields_array[i]);
			alert(cMessage);
			f[fields_array[i]].focus();
			return false;
		}
		else if (fields_array[i] == "email" && !checkEmail(f[fields_array[i]].value))
		{
			alert(_wrong_mail);
			f[fields_array[i]].focus();
			return false;
		}
	}
	if (f.phoneNumber.value == "" && f.cellPhone.value == "")
	{
		alert (_alert_phoneOrMobile);
		f.phoneNumber.focus();
		return false;
	}
	else if (f.phoneNumber.value != "" && !IsNumeric(f.phoneNumber.value))
	{
		alert (_alert_phone_invalid);
		f.phoneNumber.focus();
		return false;
	}
	else if (f.cellPhone.value != "" && !IsNumeric(f.cellPhone.value))
	{
		alert (_alert_cell_invalid);
		f.cellPhone.focus();
		return false;
	}
	else if (f.faxNumber.value != "" && !IsNumeric(f.faxNumber.value))
	{
		alert (_alert_fax_invalid);
		f.faxNumber.focus();
		return false;
	}
	else
		return confirm (_confirm_submit);
}

function check_fields_contact(f)
{
	//return true;
	var fields_array=new Array("firstName","email", "subject");
	for (i=0;i<fields_array.length;i++)
	{
		if (f[fields_array[i]].value=="")
		{
			cMessage = eval("_alert_"+fields_array[i]);
			alert(cMessage);
			f[fields_array[i]].focus();
			return false;
		}
		else if (fields_array[i] == "email" && !checkEmail(f[fields_array[i]].value))
		{
			alert(_wrong_mail);
			f[fields_array[i]].focus();
			return false;
		}
	}
/*	if (f.phoneNumber.value == "" && f.cellPhone.value == "")
	{
		alert (_alert_phoneOrMobile);
		f.phoneNumber.focus();
		return false;
	}
	else*/
	if (f.phoneNumber.value != "" && !IsNumeric(f.phoneNumber.value))
	{
		alert (_alert_phone_invalid);
		f.phoneNumber.focus();
		return false;
	}
	else if (f.cellPhone.value != "" && !IsNumeric(f.cellPhone.value))
	{
		alert (_alert_cell_invalid);
		f.cellPhone.focus();
		return false;
	}
	else
		return confirm (_confirm_submit);
}

function check_fields_myHome(f)
{
	//return true;
	var fields_array=new Array("lastName","city", "email", "myHome_picture", "description");
	for (i=0;i<fields_array.length;i++)
	{
		if (f[fields_array[i]].value=="")
		{
			cMessage = eval("_alert_"+fields_array[i]);
			alert(cMessage);
			f[fields_array[i]].focus();
			return false;
		}
		else if (fields_array[i] == "email" && !checkEmail(f[fields_array[i]].value))
		{
			alert(_wrong_mail);
			f[fields_array[i]].focus();
			return false;
		}
	}
	if (f.myHome_picture.value.lastIndexOf(".jpg") == -1 && f.myHome_picture.value.lastIndexOf(".JPG") == -1)
	{
   		alert(_picture_type);
   		f.myHome_picture.focus();
   		return false;
	}
	else if (f.phoneNumber.value == "" && f.cellPhone.value == "")
	{
		alert (_alert_phoneOrMobile);
		f.phoneNumber.focus();
		return false;
	}
	else if (f.phoneNumber.value != "" && !IsNumeric(f.phoneNumber.value))
	{
		alert (_alert_phone_invalid);
		f.phoneNumber.focus();
		return false;
	}
	else if (f.cellPhone.value != "" && !IsNumeric(f.cellPhone.value))
	{
		alert (_alert_cell_invalid);
		f.cellPhone.focus();
		return false;
	}
	else
		return confirm (_confirm_submit);
}

function changePrdPic(pic_link, bigPicUrl)
{
	pic_mc = document.getElementById("products_pic");
	pic_mc.src = pic_link.href; // Change thumbnail source to link href;
	links_tr = pic_link.parentNode.parentNode;
/*	for (i=0; i<links_tr.childNodes.length; i++)
		if (links_tr.childNodes[i].nodeType == 1) // fix for firefox finding text-nodes
			links_tr.childNodes[i].firstChild.className = "";
	pic_link.className = "selected";
	popup_link = pic_link.getAttribute("title"); // get thumbnail popup source
	thumb_link = pic_mc.parentNode;
	thumb_link.href = popup_link; // change thumbnail parent "A" tag href
	*/


	aBigPic = document.getElementById('bigpic_target');
	if (aBigPic)
		aBigPic.setAttribute('href', bigPicUrl);

	//make item selected
	var parObj = pic_link.parentNode;
	var elm = parObj.getElementsByTagName('a');

	for (i=0; i<elm.length; i++) {
		if (elm[i] == pic_link)
			elm[i].className = 'box_nav_selected';
		else
			elm[i].className = 'box_nav';
	}

	return false;
}

function PopupPic(sPicURL)
{
	var url = "xml_functions.php?function=getImageSize&picUrl="+sPicURL;
//	window.clipboardData.setData('Text',url);
	var xml = LoadXML(url);
	if(xml != null)
	{
		var height = (xml.getElementsByTagName('height')[0].firstChild.data) ? xml.getElementsByTagName('height')[0].firstChild.data : 350;
		var width = (xml.getElementsByTagName('width')[0].firstChild.data) ? xml.getElementsByTagName('width')[0].firstChild.data : 600;
	}
	popupWin("View Picture.php?picUrl="+sPicURL, parseFloat(width)+10, parseFloat(height)+30);
     return false;
}

function show_faq(c_href)
{
	var curRef = c_href;
	if (!curRef)
		return false;
	var par = curRef.parentNode;
	var div = par.getElementsByTagName('div');
	if (!div || !div[0])
		return false;

	if (div[0].style.display == "block")
		div[0].style.display = "none";
	else
		div[0].style.display = "block";

	return false;
}

function myHome_nav(nav_dir)
{
	// function for navigation through my home pictures using DOM functions
	navButton_prev = document.getElementById("navArrow_align");
	navButton_next = document.getElementById("navArrow_mir");
	navPic_mc = document.getElementById("hor_slider");
	total_pics = 0;
	for (i = 0; i < navPic_mc.childNodes.length; i++)
		if (navPic_mc.childNodes[i].nodeType == 1)
			total_pics++;
	fPic = 0;
	if (nav_dir == "next")
	{
		nodes = 0;
		for (i = 0; i < navPic_mc.childNodes.length; i++)
		{
			if (navPic_mc.childNodes[i].nodeType == 1)
			{
				for (n = 0; n < navPic_mc.childNodes[i].childNodes.length; n++)
				{
					if (navPic_mc.childNodes[i].childNodes[n].nodeType == 1)
					{
						nodes ++;
						cPic = navPic_mc.childNodes[i].childNodes[n];
						fPic = myHome_changePics(cPic, fPic);
						if (fPic < 0)
							break;
					}
				}
			}
			if (fPic < 0)
				break;
		}
		navButton_next.style.display = (nodes >= total_pics) ? "none" : "block";
		navButton_prev.style.display = (nodes-3 <= 0) ? "none" : "block";
	}
	else if (nav_dir == "prev")
	{
		nodes = total_pics;
		for (i = (navPic_mc.childNodes.length-1);i >= 0; i--)
		{
			if (navPic_mc.childNodes[i].nodeType == 1)
			{
				for (n = 0; n < navPic_mc.childNodes[i].childNodes.length; n++)
				{
					if (navPic_mc.childNodes[i].childNodes[n].nodeType == 1)
					{
						nodes --;
						cPic = navPic_mc.childNodes[i].childNodes[n];
						fPic = myHome_changePics(cPic, fPic);
						if (fPic < 0)
							break;
					}
				}
			}
			if (fPic < 0)
				break;
		}
		navButton_prev.style.display = (nodes <= 0) ? "none" : "block";
		navButton_next.style.display = (nodes-5 >= total_pics) ? "none" : "block";
	}
}

function myHome_changePics(cPic, fPic)
{
	if (cPic.style.display != "none" && !fPic)
	{
		cPic.style.display = "none";
		return fPic+1;
	}
	else if (fPic && fPic < 4)
		return fPic+1;
	else if (fPic)
	{
		cPic.style.display = "inline";
		return -1;
	}
	else
		return 0;
}

function show_mattress(mid)
{
	// function for displaying mattress in Mattress.php
	mnf_div = mid.parentNode;

	// First, hide all mattress information under parent div
	for (i=0; i<mnf_div.childNodes.length; i++)
	{
		cNode = mnf_div.childNodes[i];
		if (cNode.tagName == "DIV")
			cNode.style.display = "none";
	}
	while (mid.tagName != "DIV")
		mid = mid.nextSibling;
	mid.style.display = "inline";
	return false;
}

function init_sound()
{
	soundStat = Get_Cookie("soundStat");
	if (soundStat != 0)
	{
		flashMovie=getFlashMovieObject("eq_button");
		flashMovie.SetVariable('soundStat', 1);
		flashMovie.Play();
	}
}

function gallery_nav (nav_dir)
{
	nav = document.getElementById("nav_container");
	box = document.getElementById("gallery_nav");
	button_next = document.getElementById("navArrow_mir");
	button_prev = document.getElementById("navArrow_align");

	nav_width = parseFloat(nav.offsetWidth) - 17;
	box_width = parseFloat(box.offsetWidth);
	nav_margin = (siteLang == "heb") ? parseFloat(nav.style.marginRight) : parseFloat(nav.style.marginLeft);
	if (!nav_margin) nav_margin = 0;

	if (nav_dir == "init")
	{
		// initialize navigation arrows
		button_prev.style.display = (nav_width > box_width) ? "block" : "none";
		button_next.style.display = (nav_width > box_width) ? "block" : "none";
		new_offset = nav_margin+"px";
	}
	else if (nav_dir == "next" && box_width + (nav_margin * -1) < nav_width)
			new_offset = nav_margin-20+"px";
	else if (nav_dir == "prev" && nav_margin < 0)
	{
		new_offset = nav_margin+20+"px";
	}
	else
		new_offset = nav_margin+"px";

	(siteLang == "heb") ? nav.style.marginRight = new_offset : nav.style.marginLeft = new_offset;

}

function gallery_nav_start(nav_dir)
{
	clearInterval(nav_int);
	nav_int = setInterval("gallery_nav('"+nav_dir+"')",100);
}

function setCatText(text)
{
	var cObj = document.getElementById('cat_text');
	if (!cObj)
		return false;

	cObj.innerHTML = text;
	return true;
}


ImagePre.prototype.url;
ImagePre.prototype.img;
ImagePre.prototype.done;
ImagePre.prototype.unhide;

function ImagePre(target, url, desc, active)
{
	this.target = target;
	this.alt = desc;
	this.active = active;
	this.img_url = url;	
	this.done = false;
	
	this.img = new Image();
	this.img.src = url;

	this.unhide = function() {
		this.done = true;
	};
	this.img.onload = this.unhide;
}


function galleryBrowser(_objName, _targetID, _itemsPerPage)
{
	if (!_itemsPerPage || _itemsPerPage == 0)
		var itemsPerPage = 6;
	else
		var itemsPerPage = _itemsPerPage;
		
	var targetID = _targetID;		
	var imageObj = new Array;
	var imageIdx = 0;
	var pagePfx = 'pageID';
	var objName = _objName;
	var currentItem = -1;
	
	this.setCurrentItem = function()
	{
		currentItem = imageIdx;
	}
	
	this.addImage = function(url, image_url, desc, active)
	{
		var page = Math.floor(imageIdx/itemsPerPage);		//which page?
		//does the url has a parameters already
		parPfx = (url.match('&')) ? '&' : '?';
		url += parPfx + pagePfx + '=' + page;
		if (!active)
			active = false;
		else
			ative = true;
		//will start preloading the image directly on call
		imageObj[imageIdx++] = new ImagePre(url, image_url, desc, active);
		
		return true;
	}
	
	this.drawPage = function(pageNumber)
	{
		var obj = document.getElementById(targetID);		
		if (!obj)
			return false;
		
		//start drawing (draw to string, then add to innerHTML)
		var from = itemsPerPage * pageNumber;
		if (from >= imageIdx || from < 0)		//if non-existed page number requested
			from = 0;
		var to = from + itemsPerPage;
		if (to > imageIdx)
			to = imageIdx;
			
		i = 0;
		data = '<div class="prdPreview_min">'
		while(from < to) {
			if (from == currentItem) {
				style = 'style="background-color:#787675;"';
				url = 'javascript:void(0);'
			}
			else {
				style = null;
				url = imageObj[from].target;
			}
			className = (i%2 == 0) ? 'prd_item_img' : 'prd_item_img_ri';
			data += "<a href='" + url + "' class='" + className + "' " + style + ">";
			data += "<img src='" + imageObj[from].img_url+ "' alt='" + imageObj[from].alt + "'>";
			data += '</a>'
			from++;
			i++;
		}
		data += '</div>'	
		//data += '<div class="clear"></div>'	
		//draw navigation if required
		if (pageNumber > 0) {
			var arg = objName + '.drawPage(' + parseInt(pageNumber-1) + ');';
			data += '<a href="javascript:void(0);" class="arrow_left" onclick="javascript:' + arg + '">';
			data += '<img src="images/arrow_left.gif" alt="previous">';
			data += '</a>';
		}
		
		//next page
		if (pageNumber < Math.ceil(imageIdx / itemsPerPage) - 1 ) {
			var arg = objName + '.drawPage(' + parseInt(pageNumber+1) + ');';
			data += '<a href="javascript:void(0);" class="arrow_right" onclick="javascript:' + arg + '">';
			data += '<img src="images/arrow_right.gif" alt="next">';
			data += '</a>';			
		}
		
		obj.innerHTML = data;
		
	}
}

function check_quickContact(f)
{
	//return true;
	var fields_array=new Array("fullName","email");
	for (i=0;i<fields_array.length;i++)
	{
		if (f[fields_array[i]].value=="")
		{
			cMessage = eval("_alert_"+fields_array[i]);
			alert(cMessage);
			f[fields_array[i]].focus();
			return false;
		}
		else if (fields_array[i] == "email" && !checkEmail(f[fields_array[i]].value))
		{
			alert(_wrong_mail);
			f[fields_array[i]].focus();
			return false;
		}
	}
	if (f.phoneNumber.value != "" && !IsNumeric(f.phoneNumber.value))
	{
		alert (_alert_phone_invalid);
		f.phoneNumber.focus();
		return false;
	}

	return true;
}

function changePic(picname)
{
	var obj = document.getElementById("mainPic");	
	obj.src=picname;
}

