function a(){
	
}

function openPopUp(){
		
	var page = "test.html";
	var width = 700;
	var height = 620;
	var openWin = this.open(page, "testTitle", "toolbar=no, menubar=no ,location=no, scrollbars=yes, resizable=yes, width=" + width + ", height=" + height + ", top=" + (screen.height/2 - height/2) + ", left=" + (screen.width/2 - width/2) + "\""); 
	
//	alert(artistname + " " + itemname);
	
}

function backToTop() {
	var x1 = x2 = x3 = 0;
	var y1 = y2 = y3 = 0;

	if (document.documentElement) {
	x1 = document.documentElement.scrollLeft || 0;
	y1 = document.documentElement.scrollTop || 0;
	}

	if (document.body) {
	x2 = document.body.scrollLeft || 0;
	y2 = document.body.scrollTop || 0;
	}

	x3 = window.scrollX || 0;
	y3 = window.scrollY || 0;

	var x = Math.max(x1, Math.max(x2, x3));
	var y = Math.max(y1, Math.max(y2, y3));

	window.scrollTo(Math.floor(x / 2), Math.floor(y / 2));

	if (x > 0 || y > 0) {
	window.setTimeout("backToTop()", 25);
	}
}



//-----------------------------------------------------------------------------------------------------





function checkQualifications(){
	
	var temp_boo = false;
	
	if(document.getElementById('vqual1').checked){temp_boo = true}
	if(document.getElementById('vqual2').checked){temp_boo = true}
	if(document.getElementById('vqual3').checked){temp_boo = true}

	if(document.getElementById('q_other_f').value != ""){temp_boo = true}
	
	
	return temp_boo;
}



function checkLanguages(){
	
	var temp_boo = false;
	
	if(document.getElementById('vlang1').checked){temp_boo = true}
	if(document.getElementById('vlang2').checked){temp_boo = true}
	if(document.getElementById('vlang3').checked){temp_boo = true}
	if(document.getElementById('vlang4').checked){temp_boo = true}

	if(document.getElementById('vlang_other_f').value != ""){temp_boo = true}
	
	
	return temp_boo;
}


function checkSecretarialQualifications(){
	
	var temp_boo = false;
	
	if(document.getElementById('qual2_1').checked){temp_boo = true}
	if(document.getElementById('qual2_2').checked){temp_boo = true}
	if(document.getElementById('qual2_3').checked){temp_boo = true}
	if(document.getElementById('qual2_4').checked){temp_boo = true}
	if(document.getElementById('qual2_5').checked){temp_boo = true}
	if(document.getElementById('qual2_6').checked){temp_boo = true}

	if(document.getElementById('qual2_other_f').value != ""){temp_boo = true}
	
	
	return temp_boo;
}





function submitenqform(_nid){
	
	var missinginfo = "";
	
	

	
	
	if (document.getElementById('name_f').value == "") {
		missinginfo = "Please fill in your name.";
	} else 
	
	if (document.getElementById('address_f').value == "") {
			missinginfo = "Please fill in your address.";
	} else
	
	if (document.getElementById('tel_f').value == "") {
			missinginfo = "Please fill in your contact number.";
	} else

	
	
	if (checkQualifications() == false) {
			missinginfo = "Please fill in Qualifications fields.";
	} else
	
	
	if (checkLanguages() == false) {
			missinginfo = "Please fill in Languages.";
	} else
	
	
	if (checkSecretarialQualifications() == false) {
			missinginfo = "Please fill in Secretarial Qualifications.";
	} else
	
	
	

	if (document.getElementById('email_f').value == "") {
			missinginfo = "Please fill in your email.";
	} else
	
	if (document.getElementById('message_f').value == "") {
			missinginfo = "Please fill in Covering Message.";
	} 
	

	


	if (missinginfo != "") {

		alert(missinginfo);
		
		
	}else { 
	
	
	
		/*
		var sendvar = 
		
		        "Ref=" + document.getElementById('Ref').innerHTML 
		+ "&" + "Name=" + document.getElementById('name_f').value 
		+ "&" + "Address=" + document.getElementById('address_f').value 
		+ "&" + "Tel=" + document.getElementById('tel_f').value 
		+ "&" + "Email=" + document.getElementById('email_f').value 
		+ "&" + "Enquiry=" + document.getElementById('message_f').value
		
		+ "&" + "vqual1=" + document.getElementById('vqual1').checked
		+ "&" + "vqual2=" + document.getElementById('vqual2').checked
		+ "&" + "vqual3=" + document.getElementById('vqual3').checked
		+ "&" + "q_other_f=" + document.getElementById('q_other_f').value
		
		
		+ "&" + "vlang1=" + document.getElementById('vlang1').checked
		+ "&" + "vlang2=" + document.getElementById('vlang2').checked
		+ "&" + "vlang3=" + document.getElementById('vlang3').checked
		+ "&" + "vlang4=" + document.getElementById('vlang4').checked
		+ "&" + "vlang_other_f=" + document.getElementById('vlang_other_f').value
		
		
		
		
		+ "&" + "vqual1=" + document.getElementById('qual2_1').checked
		+ "&" + "vqual2=" + document.getElementById('qual2_2').checked
		+ "&" + "vqual3=" + document.getElementById('qual2_3').checked
		+ "&" + "vqual3=" + document.getElementById('qual2_4').checked
		+ "&" + "vqual3=" + document.getElementById('qual2_5').checked
		+ "&" + "vqual3=" + document.getElementById('qual2_6').checked
		+ "&" + "q_other_f=" + document.getElementById('qual2_other_f').value
		
		
		;
		
		
		
		$.ajaxSetup({ 
		   type: "POST" 
		 });

		$.ajax({ 
				url: "web/php/sendmail.php", 
				error:function(){
				    },
				dataType: "jsonObj",
				data: sendvar,
				success: function(json){ 


	 				alert(json);
				//	ftp_array = eval("(" + json + ")");

					delayProcess();
				}
		});
			
			
			

		*/
		document.getElementById('preloadArea').innerHTML = '<img src="web/img/ajax-loader.gif"/> &nbsp; Data Loading..';
		

		delayProcess();
		
		
		

		
	
	}


	
}

function delayProcess(){
	setTimeout("processEnd()",500);
	
}


function processEnd() {
		
	document.getElementById('preloadArea').innerHTML = '';

		
	document.enq_form.submit();
		
	
	
	
	
	// opacityTween = new OpacityTween(document.getElementById('enq_form'),Tween.cubicEaseOut, 100, 0, 0.2);
	// 		opacityTween.start();
	// 		
	// 		
	// 		
	// 		var a = new Object();
	// 		a.onMotionFinished = onFadeOutEnd;
	// 
	// 		opacityTween.addListener(a);
	


	
	
	
	
}


function onFadeOutEnd(){
	
	document.getElementById('thanks_form').innerHTML = '<span class="thanks_txt">Thank you for your enquiry. <br/> We will get in touch with you shortly.</span>';
	finTween = new OpacityTween(document.getElementById('enq_form'),Tween.cubicEaseOut, 0, 0, 0.2);
	finTween.start();
	
	var fini = new Object();
	
	
	fini.onMotionFinished = fadeOutFini;
		
	finTween.addListener(fini);
	
	
	
	
}


function fadeOutFini(){
	
	
	setTimeout("closeDrawer()", 3000);
}

function closeDrawer(){
	vs.slideOut();
	addListener_enq_bt();
	
	setTimeout("resetForm()", 1000);
	
}


function resetForm(){
	
	document.getElementById('thanks_form').innerHTML = '';
	finTween = new OpacityTween(document.getElementById('enq_form'),Tween.cubicEaseOut, 0, 100, 0.1);
	finTween.start();
	
	document.getElementById('Name').value = '';
	document.getElementById('Tel').value  = '';
	document.getElementById('Address').value  = '';
	document.getElementById('Email').value  = '';
	document.getElementById('Enquiry').value  = '';



	
}

//===============================================================================



function init(){
	
	 folioChange = new Tween(document.getElementById('property_thum_content').style, 'left', Tween.strongEaseOut, 0 , 0, 0.2, 'px');
	
}


function backToSearch(){
	top.location.href = 'index.php?sec=Home&id=Search';
    
}


function dropDownChange(dropdown){
    var myindex  = dropdown.selectedIndex;
    var SelValue = dropdown.options[myindex].value;

    var baseURL  = 'index.php?sec=Home&id=Search&sr0=' + SelValue;
    top.location.href = baseURL;
    
    return true;
}


function searchSubmit(){
	
	var s1_value = document.forms[0].select1.options[document.forms[0].select1.selectedIndex].value;
	var s2_value = document.forms[0].select2.options[document.forms[0].select2.selectedIndex].value;
	var s3_value = document.forms[0].select3.options[document.forms[0].select3.selectedIndex].value;
	
	
	
	var baseURL  = 'index.php?sec=Home&id=SearchResult' + '&k1=' + s1_value + '&k2=' + s2_value + '&k3=' + s3_value;
    top.location.href = baseURL;

    return true;
	
}




function search_result_orderByPrice(dropdown, sec, id, k1, k2, k3){
	
    var myindex2  = dropdown.selectedIndex;
    var SelValue = dropdown.options[myindex2].value;

	var v1 = '';
	var v2 = '';
	var v3 = '';
	
	
	if(k1 != ""){
		v1 = '&k1=' + k1;
	}
	if(k2 != ""){
		v2 = '&k2=' + k2;
	}
	if(k3 != ""){
		v3 = '&k3=' + k3;
	}	
	
	

    var baseURL  = 'index.php?sec=' + sec + '&id=' + id + v1 + v2 + v3 + '&order=' + SelValue;
    top.location.href = baseURL;
	
    return true;
}


function search_result_orderBySize(dropdown, sec, id, k1, k2, k3){
	
	
	var myindex2  = dropdown.selectedIndex;
    var SelValue = dropdown.options[myindex2].value;



	var v1 = '';
	var v2 = '';
	var v3 = '';
	
	
	if(k1 != ""){
		v1 = '&k1=' + k1;
	}
	if(k2 != ""){
		v2 = '&k2=' + k2;
	}
	if(k3 != ""){
		v3 = '&k3=' + k3;
	}

    var baseURL  = 'index.php?sec=' + sec + '&id=' + id + v1 + v2 + v3 + '&order=' + SelValue;
    top.location.href = baseURL;

    return true;
	
}






function moveToBottomScreen(){
	
	  if( typeof( window.innerWidth ) == 'number' ) {
	    //Non-IE
	    myWidth = window.innerWidth;
	    myHeight = window.innerHeight;
	  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	  }

	
	
//	SoftScroll.scrollTo(0, myHeight);
	SoftScroll.scrollTo(0, myHeight);
	
}





// Custom SWFAddress and Ajax handling

function handleChange(event) {
	

    var parameters = '';
    for (var p in event.parameters) {
        parameters += event.parameters[p];
    }

//	alert(event.pathNames);
	
	var slide_id = 0;
	
	if(event.pathNames == ""){
		slide_id = 0;
	}else{
		slide_id = event.pathNames;
	}
	

	flashCallBack(slide_id);
	
}


function slideFolio(col){
	
	SWFAddress.setValue('/' + col + '/');
	
	/* SWF Address Function /////////////
	
	var flash = (navigator.appName.indexOf ("Microsoft") !=-1)?window["flashId"]:document["flashId"];
    flash.actionScriptFunction(col);
	*/
     
}


//SoftScroll.init();

//SWFAddress.addEventListener(SWFAddressEvent.CHANGE, handleChange);
































var vs_array = new Array();
var bt_array = new Array();
var myWidth = 0, myHeight = 0;



function onSlideOut(e){
//	setTimeout(moveToBottomScreen, 400);

	if (!e) e = window.event;
	
	
	if(e.target != null){
		
		
		for (var i=0; i < vs_array.length; i++) {
			if(Number(e.target.id_no) == i){
				vs_array[i].slideIn();		
				addListener_enq_bt_rev(i);
				bt_array[i].innerHTML = "< CLOSE";

			}else{
				vs_array[i].slideOut();		
				addListener_enq_bt(i);
				bt_array[i].innerHTML = "SEND CV >";

			}

		};
		
	}else if(e.srcElement != null){
		
		for (var i=0; i < vs_array.length; i++) {
			if(Number(e.srcElement.id_no) == i){
				vs_array[i].slideIn();		
				addListener_enq_bt_rev(i);
				bt_array[i].innerHTML = "< CLOSE";

			}else{
				vs_array[i].slideOut();		
				addListener_enq_bt(i);
				bt_array[i].innerHTML = "SEND CV >";

			}

		};
		
		
		
		
	}
	
	
	
}

function onSlideIn(e){
	
	if (!e) e = window.event;
	if(e.target != null){
		vs_array[e.target.id_no].slideOut();		
		addListener_enq_bt(e.target.id_no);
		bt_array[e.target.id_no].innerHTML = "SEND CV >";
		
	}else if(e.srcElement != null){
		vs_array[e.srcElement.id_no].slideOut();		
		addListener_enq_bt(e.srcElement.id_no);
		bt_array[e.srcElement.id_no].innerHTML = "SEND CV >";
		
	}

	
}





function addListener_enq_bt(_num){
	
//	vs.addEvent('complete', moveToBottomScreen);
	
	bt_array[_num].removeEvent("click", onSlideIn);
	
	bt_array[_num].addEvent("click", onSlideOut);
}

function addListener_enq_bt_rev(_num){
	//vs.removeEvent('complete', moveToBottomScreen);
	
	
	bt_array[_num].removeEvent("click", onSlideOut);
	
	bt_array[_num].addEvent("click", onSlideIn);

}

function enquiry_init(_num){
	

	

		var vs = new Fx.Slide("vertical_slide" + _num);
		vs.id_no = _num;
		vs.hide();

		
		$("v_slidein" + _num).id_no = _num;

		$("v_slidein" + _num).addEvent("click", onSlideOut);
		
		vs_array.push(vs);
		bt_array.push($("v_slidein" + _num));

		
		
		
}
