// JavaScript Document

//preload

pic1= new Image(); 
pic1.src="http://www.officeexec.com/v2/assets/cssImages/contact_btn_over.png";

pic2= new Image(); 
pic2.src="http://www.officeexec.com/v2/assets/cssImages/booking_over.png";

pic3= new Image(); 
pic3.src="http://www.officeexec.com/v2/assets/images/payment_over.png";




function imageRollOver(obj,url){	
	obj.src = url;	
}

function openChat(){
	//href="http://www.google.com/talk/service/badge/Start?tk=z01q6amlqojdres96bnd6ebkd7b4n4pdhrjvce855b81d4d4l4o77dfb0913hqvvpgl8thm59pko0dmp77jvvb6e9upbkqsrqn2cl5nfdjo1l470nsvca0asddc7mve6msbhab1u5tpujtk0qsh5s7r0ksu8ep109e4p6rnou"
	clicky.log('#chat');
	
	//var chatUrl = "http://www.google.com/talk/service/badge/Start?tk=z01q6amlqcn92bhaess8jbt3cm6p2id804ngsp3qm4tk6hbkmra4ffubiecs99jco93ao16q2unj2070a65hu33ricc0vp2ij6rlt2kottmf032mjktdj84o0clesbif41f7e539q76r8sgc4d7squr0kqtd7dr4h7jnp70i5";
	var chatUrl = "http://www.google.com/talk/service/badge/Start?tk=z01q6amlq1ti80p8l4el1r9fud1elv7rhiicpajeimb7hglefnqloglau5ebcfcueqm9phj7qrpa91qo8dj2fio25a044il4itqh2ksglofomfnmbl6cgvbvaif0tkobll664g5m5hg7qqto2859cqsjknbsms4dj3u451ff9t63jk99ivi832cvsnhik47dc78"
	window.open(chatUrl, 'chat', 'toolbar=0,scrollbars=0,location=0,statusbar=1,menubar=0,resizable=1,width=350,height=500,left = 785,top = 290');
	
}



function submitForm(){

	var form = document.getElementById('indexForm');
	var inpts = form.getElementsByTagName("input");
	
	var clear = true;

	for(var i = 0; i < inpts.length; i++){
		if(inpts[i].value == ""){
			clear = false;
			switch(inpts[i].name){
				case "name":
					alert("Please provide us with your name");					
					break;
				case "phone":
					alert("Please provide us with your phone number");					
					break;
				case "email":
					alert("Please provide us with email address");					
					break;					
			}
			break;
		}else{
			if(inpts[i].value == "(Name)"){ 
				alert("Please provide us with your name"); 
				clear = false;
			}
			if(inpts[i].value == "(Phone)"){ 
				alert("Please provide us with your phone");
				clear = false;
			}
			if(inpts[i].value == "(Email)"){ 
				alert("Please provide us with your email"); 
				clear = false;
			}			
		}
	}
	
	if(clear == true){
		form.submit();	
	}
}




function more(id){
	
	var obj = document.getElementById(id);
	obj.style.visibility = "true";
	
	var btn = document.getElementById(id+"_btn");
	btn.innerHTML = "<a href='javascript:less('"+id+"')'>Less</a>";
	
}


function less(id){
	
	var obj = document.getElementById(id);
	obj.style.visibility = "false";
	
	var btn = document.getElementById(id+"_btn");
	btn.innerHTML = "<a href='javascript:more('"+id+"')'>More</a>";	
	
}

function handleMail(){
	var send = "mailto:info@officeexec.com";
	document.location = send;
	clicky.log("#email","Email");
}


function activatePlaceholders() {	
	
	var detect = navigator.userAgent.toLowerCase(); 
	
	var inputs = document.getElementsByTagName("input");


	if (detect.indexOf("safari") > 0) return false;

	
	for(var i = 0; i < inputs.length; i++) {
		var type = inputs[i].getAttribute("type");
		
		if ( type == "text") {
			
			if( inputs[i].getAttribute("placeholder") && (inputs[i].getAttribute("placeholder").length > 0) ) {
	
				
				inputs[i].value = inputs[i].getAttribute("placeholder");
			    
				
				
				inputs[i].onfocus = function() {
				    if (this.value == this.getAttribute("placeholder")) {
				    	this.value = "";
				    }		
			    }
				
				inputs[i].onblur = function() {	
					if (this.value.length < 1) { 
						this.value = this.getAttribute("placeholder");
					} 
				}	
				
				
			}    
		    
		}
	}
	
}



function init(){
	//set form position
	var div = document.getElementById("contentCol_3");
	
	var winW = 630;
	var winH = 460;
	if (document.body && document.body.offsetWidth) {
	 winW = document.body.offsetWidth;
	 winH = document.body.offsetHeight;
	}
	if (document.compatMode=='CSS1Compat' &&
	    document.documentElement &&
	    document.documentElement.offsetWidth ) {
	 winW = document.documentElement.offsetWidth;
	 winH = document.documentElement.offsetHeight;
	}
	if (window.innerWidth && window.innerHeight) {
	 winW = window.innerWidth;
	 winH = window.innerHeight;
	}
	
	
	if( winH  < 700 ) div.style.marginTop = "-405px";
	
	activatePlaceholders();
	
	//_gaq.push(['_trackPageview',location.pathname + location.hash]);
	
}


