$(document).ready(function() {
	 P7_equalCols2(0,'left-column-holder','H5','right-column','H5')
	  $('div.accordion> div').hide();
	  $('div.accordion> h3').click(function() {
		$(this).next('div').slideToggle('fast')
		.siblings('div:visible').slideUp('fast');
	  });
	});
	
$(function() { 
    $('h1').media(function(el, options) { 
        options.caption = false; 
        options.height = '45px'; 
		options.width = '557px';
        options.src = '/flash/h1.swf'; 
        options.flashvars.txt = $(el).text(); 
    }); 
});

$(function() { 
    $('h2').media(function(el, options) { 
        options.caption = false; 
        options.height = '25px'; 
		options.width = '557px';
        options.src = '/flash/h2.swf'; 
        options.flashvars.txt = $(el).text(); 
    }); 
});


function ajaxFunction(a)
	{  
	var xmlHttp;
	try
		{    
  		// Firefox, Opera 8.0+, Safari   
		xmlHttp=new XMLHttpRequest();
  		}
	catch (e)
		{    
		// Internet Explorer    
		try
			{     
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");      	
			}
		catch (e)
      		{
	  		try
       			{        
	   			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");        
	   			}
     		catch (e)
        		{        
				alert("Your browser does not support AJAX!");        
				return false;        
				}      
			}    
		}
		xmlHttp.onreadystatechange=function()
  			{
     		if(xmlHttp.readyState==4)
        		{
				setDivContents("contact-right",xmlHttp.responseText)

       			}
			}
			xmlHttp.open("GET","/ajax/contact.jsp?id="+a,true);
    		xmlHttp.send(null);  
		}


/* sets the html content of a specified DIV id - cross browser compatible */
function setDivContents(divName, string){
//salert(string);
	var type	=	getBrowser();
	var obj		=	getObjectReference(divName);
	if(type == "IE"){
		obj.innerHTML	=	string;
	}else if(type == "NN"){
		obj.document.open();
		obj.document.write(string);
		obj.document.close();
	}else if(type == "MO" || type == "OP"){
		obj.innerHTML	=	string;
	}
}

/* Returns the type of browser on the client side */
function getBrowser(){
	var type	=	"IE";//set the default type according to most common
	if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById){
		type	=	"OP";
	}
	if (document.all){
		type	=	"IE";
	}
	if (document.layers){
		type	=	"NN";
	}
	if (!document.all && document.getElementById){
		type	=	"MO";
	}
	return type;
}

/* get object reference according to browser - mainly used for styling objects */
function getObjectReference(divName){
	var type	=	getBrowser();
	var object	=	false;
	if(type == "IE"){
		object = document.getElementById(divName);
		//object = document.all[divName];
	}else if(type == "NN"){
		object = document.layers[divName];
	}else if(type == "MO" || type == "OP"){
		object = document.getElementById(divName);
	}
	return object;
}

function validate(object,text)
{
    if (object.value.length > 0)

        return true;

    else

        return false;

}

function formvalidate() {
	validated = true;
    if (!validate(document.itForm.first_name,'first_name'))
        validated = false;
    if (!validate(document.itForm.last_name,'last_name'))
        validated = false;
    if (!validate(document.itForm.email, 'email'))
        validated = false;
    if (!validate(document.itForm.country, 'country'))
        validated = false;
    if (!validated)
        alert('One or more of the required fields are empty. Please complete the form, then submit again.');
	if(validated==true){
		if(document.itForm.confirmBox.checked==false){
		 	validated = false;
		 	alert("You must confirm that you have read and agree to the Allfinanz Privacy Statement and Terms of Use before you can continue");
		}
	}	
	if(validated==true){
	document.itForm.submit()	
	}
 }


