function formSubmit(){

	if(document.getElementById('contact_fname').value.length==0 || document.getElementById('contact_company').value.length==0 || document.getElementById('contact_email').value.length==0)
		{
			if(document.getElementById('contact_fname').value.length==0) document.getElementById('error_fname').style.display="block";
			if(document.getElementById('contact_company').value.length==0) document.getElementById('error_company').style.display="block";
			if(document.getElementById('contact_email').value.length==0) document.getElementById('error_email').style.display="block";				

			document.getElementById('error_msg_hider').style.display = 'block';
			document.getElementById('error_msg_aln').style.display = 'block';

		} else {
			 //	 document.getElementById('smallcontact').submit();
                            		 getformpost_captcha("processcontacts.php","smallcontact");
		}
}

function formClose(){

	document.getElementById('error_fname').style.display = 'none';
	document.getElementById('error_company').style.display = 'none';
	document.getElementById('error_email').style.display = 'none';

	document.getElementById('error_msg_hider').style.display = 'none';
	document.getElementById('error_msg_aln').style.display = 'none';
};

function requestSubmit(){
	document.getElementById('vip_request_form').style.display = '';
};
function requestClose(){
	document.getElementById('vip_request_form').style.display = 'none';
}


function closeDiv(){
// alert('Flash removed');
 document.getElementById("bottomDiv").style.display = 'none';
 document.getElementById("scaleDiv").style.display = 'none';
}


function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}

function getBodyScrollTop()
{
	return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}

function getBodyScrollLeft()
{
	return self.pageXOffset || (document.documentElement && document.documentElement.scrollLeft) || (document.body && document.body.scrollLeft);
}

function getClientWidth()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientWidth:document.body.clientWidth;
}

function getClientHeight()
{
  return document.compatMode=='CSS1Compat' && !window.opera?document.documentElement.clientHeight:document.body.clientHeight;
}

function getClientCenterX()
{
		var arrayPageSize = getPageSize();
		var hei=arrayPageSize[1];
		var wid=document.body.scrollWidth;

	return parseInt(wid/2);
}

function getClientCenterY()
{
		var arrayPageSize = getPageSize();
		var hei=arrayPageSize[1];
		var wid=document.body.scrollWidth;

	return parseInt(hei/2)+getBodyScrollTop();
}



	function openPopup()
		{
		var width=330;
		var height=320;
		var arrayPageSize = getPageSize();
		var hei=arrayPageSize[1]-0;
		var wid=document.body.scrollWidth;

		var half_width=width/2;
		var half_height=height/2;

		document.getElementById('shaded').style.height=hei+"px";
		document.getElementById('shaded').style.width=wid+"px";

		if((getClientCenterY()-half_height)>0) var tp=getClientCenterY()-half_height-60; else var tp=10;

		document.getElementById('infoiframe_div').style.top=tp+"px";
		document.getElementById('infoiframe_div').style.left=(getClientCenterX()-half_width)+"px";

		document.getElementById('infoiframe_div').style.width=width+"px";
		document.getElementById('infoiframe_div').style.height=height+"px";
	
		document.getElementById('shaded').className="shaded_vis";
		document.getElementById('infoiframe_div').className="infoiframe_visible";
		}


	function openPopup2()
		{
		var width=330;
		var height=320;
		var arrayPageSize = getPageSize();
		var hei=arrayPageSize[1]-0;
		var wid=document.body.scrollWidth;

		var half_width=width/2;
		var half_height=height/2;

		document.getElementById('shaded').style.height=hei+"px";
		document.getElementById('shaded').style.width=wid+"px";

		if((getClientCenterY()-half_height)>0) var tp=getClientCenterY()-half_height-60; else var tp=10;

		document.getElementById('infoiframe_div2').style.top=tp+"px";
		document.getElementById('infoiframe_div2').style.left=(getClientCenterX()-half_width)+"px";

		document.getElementById('infoiframe_div2').style.width=width+"px";
		document.getElementById('infoiframe_div2').style.height=height+"px";

		document.getElementById('shaded').className="shaded_vis";
		document.getElementById('infoiframe_div2').className="infoiframe_visible";
		}


	function openCaptcha(args)
		{
		var width=370;
		var height=230;
		var arrayPageSize = getPageSize();
		var hei=arrayPageSize[1]-0;
		var wid=document.body.scrollWidth;

		var half_width=width/2;
		var half_height=height/2;

		document.getElementById('shaded').style.height=hei+"px";
		document.getElementById('shaded').style.width=wid+"px";

		if((getClientCenterY()-half_height)>0) var tp=getClientCenterY()-half_height-60; else var tp=10;

		document.getElementById('infoiframe_div4').style.top=tp+"px";
		document.getElementById('infoiframe_div4').style.left=(getClientCenterX()-half_width)+"px";

		document.getElementById('infoiframe_div4').style.width=width+"px";
		document.getElementById('infoiframe_div4').style.height=height+"px";

		document.getElementById('url').src="incs/captcha.php?"+args;

		document.getElementById('shaded').className="shaded_vis";
		document.getElementById('infoiframe_div4').className="infoiframe_visible";
		}



	function openPopup3()
		{
		var width=450;
		var height=350;
		var arrayPageSize = getPageSize();
		var hei=arrayPageSize[1]-0;
		var wid=document.body.scrollWidth;

		var half_width=width/2;
		var half_height=height/2;

		document.getElementById('shaded').style.height=hei+"px";
		document.getElementById('shaded').style.width=wid+"px";

		if((getClientCenterY()-half_height)>0) var tp=getClientCenterY()-half_height-60; else var tp=10;

		document.getElementById('infoiframe_div3').style.top=tp+"px";
		document.getElementById('infoiframe_div3').style.left=(getClientCenterX()-half_width)+"px";

		document.getElementById('infoiframe_div3').style.width=width+"px";
		document.getElementById('infoiframe_div3').style.height=height+"px";
	
		document.getElementById('shaded').className="shaded_vis";
		document.getElementById('infoiframe_div3').className="infoiframe_visible";
		}


	function closepopup()
		{
			document.getElementById('shaded').className="shaded_hid";
			document.getElementById('infoiframe_div').className="infoiframe_hidden";

		}

	function closepopup2()
		{
			document.getElementById('shaded').className="shaded_hid";
			document.getElementById('infoiframe_div2').className="infoiframe_hidden";

		}


	function closepopup3()
		{
			document.getElementById('shaded').className="shaded_hid";
			document.getElementById('infoiframe_div3').className="infoiframe_hidden";

		}

	function closecaptcha()
		{
			document.getElementById('shaded').className="shaded_hid";
			document.getElementById('infoiframe_div4').className="infoiframe_hidden";
			document.getElementById('url').src="incs/captcha.php?nulled=1";
		}







function getRequestBody(oForm) { 
     var aParams = new Array();
     for(var i = 0; i < oForm.elements.length; i++) {
         var sParam = encodeURIComponent(oForm.elements[i].name);
         sParam += "=";
         sParam += encodeURIComponent(oForm.elements[i].value);
         aParams.push(sParam);
     }
     return aParams.join("&");
 }

function resetForm(formid){
document.getElementById(formid).reset();
}

 function getformpost(script,form) {
         var nameRequestForm = document.getElementById(form);
         var post_arg = getRequestBody(nameRequestForm);
         
					AjaxRequest.post(
					  {
					    'queryString': post_arg,
					    'url':'incs/'+script,'onSuccess':function(req)
							{ 
								var dest_div='ajaxcontainer';
								obj = document.getElementById(dest_div);
								alert(req.responseText); 
								resetForm("share_form");
								closepopup3();		
							}
					    ,'timeout':30000
					    ,'onTimeout':function(req){ getformpost(script,form); }
					  }
					);

 }


 function getformpost_captcha(script,form) {
         var nameRequestForm = document.getElementById(form);
         var post_arg = getRequestBody(nameRequestForm);
         
					AjaxRequest.post(
					  {
					    'queryString': post_arg,
					    'url':'incs/'+script,'onSuccess':function(req)
							{ 
								var dest_div='ajaxcontainer';
								obj = document.getElementById(dest_div);
								//alert(req.responseText); 
								openCaptcha(post_arg);
								resetForm(form);
							}
					    ,'timeout':30000
					    ,'onTimeout':function(req){ getformpost_captcha(script,form); }
					  }
					);

 }



	function validateShare(){
                var errstring='';
                var flag=1;

	                if(document.getElementById('share_frname').value.length<=0) { errstring=errstring+'- Your Name\n'; flag=0; }
	                if(document.getElementById('share_fremail').value.length<=0) { errstring=errstring+'- Your Email\n'; flag=0; }

	                if(document.getElementById('share_name').value.length<=0) { errstring=errstring+'- Friend\'s Name\n'; flag=0; }
	                if(document.getElementById('share_email').value.length<=0) { errstring=errstring+'- Friend\'s Email\n'; flag=0; }
                              if(flag==0) alert('Please fill out these fields correctly:\n\n'+errstring);
                               	else  {

                              		 getformpost("shareprocess.php","share_form");
					}
				return false;

	}


function callExternalInterface(id) {
    thisMovie(id).pauseOnExit();
}

function killmovie(id) {
//    thisMovie(id).killMovie();
}


function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName]
    }
    else {
        return document[movieName]
    }
}

	function hideAllTips(){
		document.getElementById('tip_0').style.display='none';
		document.getElementById('tip_1').style.display='none';
		document.getElementById('tip_2').style.display='none';
		document.getElementById('tip_3').style.display='none';
	}

function showTip(num){
	hideAllTips();
	document.getElementById('tip_'+num).style.display='block';
}

