
//.................. Code for Image Preloader ................................
var src_path = './images/';                                 // image path 
var perload_img = ['loading.gif','addh.gif','batroomh.gif','doormersh.gif','extensionh.gif','kitchenh.gif','mash.gif','abouth.gif','contahct.gif','homeh.gif','projecth.gif','rooofinh.gif'];                                           // Pre load images
var pre_img_obj = new Array();
for (i=0; i<perload_img.length-1; i++ ){
	pre_img_obj[i] = document.createElement('img');
	pre_img_obj[i].src = src_path + perload_img[i]; 
}
//.................. End Code for Image Preloader ............................

function loadImg(obj,img_src){
	if(img_src)	new Fx.Style($('im'), 'opacity',{duration: 100}).start(1,0);			
	new Fx.Style($('im'), 'padding-top').set(90);	
	$('im').src = 'images/loading.gif';
	new Fx.Style($('im'), 'opacity',{duration: 100}).start(0,1);
	if($('info')) $('info').remove();
	new Asset.images([img_src], {
			onComplete: function(){
				new Fx.Style($('im'), 'padding-top').set(0);
				new Fx.Style($('im'), 'opacity').set(0);
				$('im').src = img_src;
				new Fx.Style($('im'), 'opacity',{duration:500}).start(0,1);													
				var myValues = $('im').getCoordinates(); // information box
				topx = myValues.bottom;
				leftx = myValues.left;
				widthx = myValues.width;
				heightx = myValues.height;
				elm = new Element('div', {'styles': {
											'position': 'absolute','z-index': 100,
											'background': '#ffffff',
											'width': widthx-10, 
											'padding': 5,
											'top': topx,
											'left': leftx,
											'opacity': 0,
											'clear':'both'
										},
										'id': 'info'});	
				$('c').appendChild(elm);
				elm.innerHTML = '<span>'+obj.title+'</span>';
				
				var upto;				
				//upto = (window.event)?  (heightx-20) : (heightx-27);
				upto = 	heightx-26+68;
															
				new Fx.Style($('info'), 'opacity',{duration:2000}).start(0,0.7);
				elm.effect('top',{duration: 1000, transition: Fx.Transitions.Sine.easeInOut}).start(topx,upto);
			}
	});	
}













function formchk()
{
	submitOK=true;
	var name = document.form01.name.value;
	var city = document.form01.city.value;
	var phone = document.form01.phone.value;
	var emailaddress = document.form01.emailaddress.value;
	var comment = document.form01.comment.value;
	
	if( ( name == '') ||  ( city == '') ||( phone == '') ||( emailaddress == '') ||( comment == '')  )
	{
		submitOK=false;
		alert( 'Please complete required fields. Required fields are marked with an asterisk *' );
		 return false;
	}
	
	else if( emailaddress != '')
	{
		var myRegExp=/(([\w\.%\/])@((?!([\.n]))[a-z])*).(((?!([\.n]))[a-z])*)$/i;
		if(!(myRegExp.test(emailaddress)))
		{
			submitOK=false;
			alert("Provide valid email address");
			 return false;
		}
	}
	
	else
	{
      return true;	
	}
}

