//************************************************************************//
// JavaScript Document
//************************************************************************//

//************************************************************************//
//CHANGE COLOR
function color_change(that){
	var url = that.options[that.selectedIndex].value;
	window.location = url;
}//end function

//************************************************************************//
//CHANGE STYLE
function style_change(that){
	var url = that.options[that.selectedIndex].value;
	window.location = url;
}//end function

//************************************************************************//
//CHANGE LANGUAGE
function lang_change(that){
	var url = that.options[that.selectedIndex].value;
	window.location = url;
}//end function

//************************************************************************//
//FADE
function opacity(id, opacStart, opacEnd, millisec) { 
	//speed for each frame 
	var speed = Math.round(millisec / 100); 
	var timer = 0; 
	//determine the direction for the blending, if start and end are the same nothing happens 
	if(opacStart > opacEnd){ 
		for(i = opacStart; i >= opacEnd; i--){ 
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}//end for
	}else if(opacStart < opacEnd){
		for(i = opacStart; i <= opacEnd; i++){
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}//end for
	}//end if
}//end function
//change the opacity for different browsers 
function changeOpac(opacity, id){ 
	var object = document.getElementById(id).style;
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}//end function

//************************************************************************//
//AUTOMATICALLY RESIZE IFRAME
function resizeIframe(){
	document.getElementById('iprofile').style.height = document.getElementById('iprofile').contentWindow.document.body.scrollHeight + 'px';
}//end function

//************************************************************************//
//SHOW/HIDE
function showhide(id){
	if(document.getElementById(id).style.display == "block"){
		document.getElementById(id).style.display = 'none';
	}else{
		document.getElementById(id).style.display = 'block';
	}//end if
}//end function

//************************************************************************//
//CHECK FORM CONTACT
function chk_contact(frm_contact){
	if(frm_contact.fullname.value == ""){alert("please enter your fullname");frm_contact.fullname.focus();return(false);}//end if
	if(frm_contact.email.value.indexOf("@",0) == -1){alert("please enter your email address");frm_contact.email.focus();return(false);}//end if
	if(frm_contact.subject.value == ""){alert("please enter your message subject");frm_contact.subject.focus();return(false);}//end if
	if(frm_contact.message.value == ""){alert("please enter your message");frm_contact.message.focus();return(false);}//end if
	return(true);
}//end function

//************************************************************************//
//CHECK FORM DAN GRADE
function chk_dangrades(frm_dangrades){
	if(frm_dangrades.name.value == ""){alert("please enter your name");frm_dangrades.name.focus();return(false);}//end if
	if(frm_dangrades.email.value.indexOf("@",0) == -1){alert("please enter your email address");frm_dangrades.email.focus();return(false);}//end if
	if(frm_dangrades.subject.value == ""){alert("please enter your message subject");frm_dangrades.subject.focus();return(false);}//end if
	if(frm_dangrades.message.value == ""){alert("please enter your message");frm_dangrades.message.focus();return(false);}//end if
	return(true);
}//end function

//************************************************************************//
//CHECK FORM SUBSCRIBE
function chk_subscribe(frm_subscribe){
	if(frm_subscribe.subscribe.value.indexOf("@",0) == -1){alert("please enter your email address");frm_subscribe.subscribe.focus();return(false);}//end if
	return(true);
}//end function

//************************************************************************//
//CHECK FORM ADVERTISE
function chk_advertise(frm_advertise){
	if(frm_advertise.fullname.value == ""){alert("please enter your fullname");frm_advertise.fullname.focus();return(false);}//end if
	if(frm_advertise.email.value.indexOf("@",0) == -1){alert("please enter your email address");frm_advertise.email.focus();return(false);}//end if
	if(frm_advertise.contact.value == ""){alert("please enter your contact number");frm_advertise.contact.focus();return(false);}//end if
	if(frm_advertise.title.value == ""){alert("please enter your advert title");frm_advertise.title.focus();return(false);}//end if
	if(frm_advertise.content.value == ""){alert("please enter your advert content");frm_advertise.content.focus();return(false);}//end if
	if(!frm_advertise.accept_terms.checked){alert("you need to accept the terms and conditions before you can continue");frm_advertise.accept_terms.focus();return(false);}//end if
	return(true);
}//end function