function change_pic (path_main, path_source, desc,wi,he) {
	if (path_main!="") {
	document.getElementById("mainpic_holder").innerHTML="<a href=\"javascript:showpicture('/config/galpicture.php?file="+path_source+"',"+wi+","+he+")\"><img src=\"/pictures/Image/gallery/"+path_main+"\" width=\"350\" height=\"350\" border=\"4\" class=\"imgbig\" alt=\"click to enlarge\" title=\"click to enlarge\"></a>";
	document.getElementById("description_holder").innerHTML="<span class=\"index\">"+desc+"</span>";
}
}
function check_email(emcheck) {

	if (!(emcheck.indexOf(".") > 2) || !(emcheck.indexOf("@") > 0)) {
		alert('Please specify correct email address!');
		return false;
	}
	else {
		return true;
	}
	
}


function checkcontactform() {
	if (document.contactform.e_firstname.value=="" || 
		document.contactform.e_lastname.value=="" ||	
		document.contactform.e_email.value=="" ||	 !check_email(document.contactform.e_email.value))
	 {
		alert ('All fields marked with * are required!');
		return false;
	}
	else {
		return true; 
	}
}

function number_format( number, decimals, dec_point, thousands_sep ) {
    var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals;
    var d = dec_point == undefined ? "." : dec_point;
    var t = thousands_sep == undefined ? "," : thousands_sep, s = n < 0 ? "-" : "";
    var i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
    
    return s + (j ? i.substr(0, j) + t : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - i).toFixed(c).slice(2) : "");
}




function newImage(arg) {
  if (document.images) {
    rslt = new Image();
    rslt.src = arg;
    return rslt;
  }
}
var preloadFlag = false;


function changeImages() {
    preloadFlag = true;
  if (document.images && (preloadFlag == true)) {
    for (var i=0; i<changeImages.arguments.length; i+=2) {
      document.getElementById([changeImages.arguments[i]]).src = changeImages.arguments[i+1];
    }
  }
}

function preloadImages() {
  if (document.images) {
    home_on = newImage("../images/home_.gif");
    about_on = newImage("../images/about_.gif");
    gallery_on = newImage("../images/gallery_.gif");
    news_on = newImage("./images/news_.gif");
    testimonials_on = newImage("../images/testimonials_.gif");
    links_on = newImage("../images/links_.gif");
    contact_on = newImage("../images/contact_.gif");

  preloadFlag = true;
  }
}


 function showpicture(url,width, height)
	{
        LeftPosition=(screen.width)?(screen.width-width)/2:100;
     TopPosition=(screen.height)?(screen.height-height)/2:100;
        var Win = window.open(url,'showpic','width=' + width + ',height=' + height + ',top='+TopPosition+',left='+LeftPosition+',resizable=0,scrollbars=no,menubar=no,toolbar=no,status=no')
	}

 function openpopup(url,width, height,scrollable)
	{
        LeftPosition=(screen.width)?(screen.width-width)/2:100;
     TopPosition=(screen.height)?(screen.height-height)/2:100;
if (scrollable==0 || scrollable=="")
        var Win = window.open(url,'showpic','width=' + width + ',height=' + height + ',top='+TopPosition+',left='+LeftPosition+',resizable=0,scrollbars=no,menubar=no,toolbar=no,status=no')
else 
        var Win = window.open(url,'showpic','width=' + width + ',height=' + height + ',top='+TopPosition+',left='+LeftPosition+',resizable=0,scrollbars=yes,menubar=no,toolbar=no,status=no')

	}


