﻿// JavaScript Document
function check_form_social_add(form){
	if(form.elements["data[Social][social_name]"].value == ""){
		alert('您忘了輸入社群名稱!');
		form.elements["data[Social][social_name]"].focus();
		return false;
	}
	if(form.elements["data[Social][social_classification]"].value == ""){
		alert('您忘了選擇社群分類!');
		form.elements["data[Social][social_classification]"].focus();
		return false;
	}
	if(form.images_social.value==""){
		if(form.elements["data[Social][social_hasuploadpic]"].value == ""){
			alert('您忘了上傳社群照片!');
			form.images_social.focus();
			return false;
		}
	}
	if(form.images_social.value!=""){
		var fileext=form.images_social.value.substring(form.images_social.value.length-4,form.images_social.value.length);
		fileext=fileext.toLowerCase();
		if(!(fileext=='.jpg' ||fileext=='jpeg')){
			alert("圖片格式不正確,請上傳*.jpg或*.jpeg的圖片格式!");
			form.images_social.focus();
			return false;
		}
	}
	if(form.elements["data[Social][social_description]"].value == ""){
		alert('您忘了輸入社群說明!');
		form.elements["data[Social][social_description]"].focus();
		return false;
	}
	return true;
}

/**
 * notice sidebar menu controll (open or close of the list in the menu)
 * @author agon
 * @param string $param1 name of the list_element_span
 */
function showhide(outline){
	if (outline.style.display=="none"){
		outline.style.display="";
	}
	else{
		outline.style.display="none";
	}
}

