	function confirmDelete(id, ask, url) //confirm order delete
	{
		temp = window.confirm(ask);
		if (temp) //delete
		{
			window.location=url+id;
		}
	}
	function open_window(link,w,h)
	{
		var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
		newWin = window.open(link,'newWin',win);
	}

function check_ad(){
var chk ="true"

	if (document.getElementById ("group").value==0){ $("#group_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/error.gif' title='" +  "گروه آگهی را انتخاب کنید" + "' />");chk="false"  }else{  $("#group_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/ok.gif' />"); }

	if (document.getElementById ("ad_type").value=="انتخاب نوع تبلیغ"){ $("#ad_type_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/error.gif' title='" + "نوع آگهی را انتخاب کنید"+ "' />");chk="false"  }else{  $("#ad_type_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/ok.gif' />");}
	
	if (document.getElementById ("head").value==''){ $("#head_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/error.gif' title='" + "عنوان آگهی را وارد کنید"+ "' />");chk="false"  }else{  $("#head_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/ok.gif' />");}
	
	if (document.getElementById ("body").value==''){ $("#body_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/error.gif' title='" + "متن آگهی را وارد کنید"+ "' />");chk="false"  }else{  $("#body_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/ok.gif' />"); }
	
	if (document.getElementById ("until").value==''){ $("#until_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/error.gif' title='" + "مدت زمان نمایش آگهی را وارد کنید"+ "' />");chk="false" }else{  $("#until_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/ok.gif' />");}
	
	if((document.getElementById ("until").value)>0){  $("#until_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/ok.gif' />") }else { $("#until_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/error.gif' title='" + "لطفا عدد وارد کنید"+ "' />");chk="false" } 
	
	if (document.getElementById ("ader_name").value==''){ $("#ader_name_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/error.gif' title='" + "نام آگهی دهنده را وارد کنید"+ "' />");chk="false" }else{  $("#ader_name_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/ok.gif' />"); }


if (document.getElementById ("ad_type").value=="عکسدار"){
	if (document.getElementById ("upl").value==''){ $("#upl_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/error.gif' title='" + "فایل خود را آپلود کنید"+ "' />");chk="false" }else{  $("#upl_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/ok.gif' />");}	
}

if (document.getElementById ("ad_type").value=="انیمیشن"){
	if (document.getElementById ("upl").value==''){ $("#upl_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/error.gif' title='" + "فایل خود را آپلود کنید"+ "' />");chk="false" }else{  $("#upl_e").html ("<img width='20px' height='20px' src='templates/hm002_wedding_floral/images/ok.gif' />");}	
}
$('#erro').hide()

	if (chk=="false") { 
		for (var i=600 ; i>560; i-- ) {
			window.scrollTo(i+100,i+100)	
		}
		$('#erro').text ("موارد مشخص شده اشکال دارند")
		$('#erro').show(1500)
		//$('#erro').show()
		return false ;
		}else{
		return true ;
	}
	
}

function reg(){
var chk=false;

if (document.getElementById ("user_name").value==''){ $("#user_name_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> نام کاربری </div>");chk="false" }else if (document.getElementById ("user_name").value.length <5){ 
	$("#user_name_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> نام کاربری نمیتواند کمتر از 5 کارکتز باشد </div>")
	chk="false"
}else {
	$("#user_name_e").html ("نام کاربری ");
}

if (document.getElementById ("famil").value==''){ $("#famil_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> نام و نام خانوادگی </div>");chk="false" }else{ $("#famil_e").html ("نام و نام خانوادگی");}

if (document.getElementById ("email").value==''){ $("#email_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> آدرس ایمیل </div>");chk="false" }else{ $("#email_e").html ("آدرس ایمیل");}

if (document.getElementById ("password").value==''){ $("#password_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> رمز عبور </div>");chk="false" }else if (document.getElementById ("password").value.length <6){
	 $("#password_e").html("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> رمز عبور کمتر از 6 کارکتر نمیتواند باشد </div>")
	chk="false"
}else{
	$("#password_e").html ("رمز عبور");	
}

if (document.getElementById ("re-password").value==''){ $("#re-password_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> تکرار رمز عبور</div>");chk="false" }else if(document.getElementById ("re-password").value.length <6 ){
 	$("#re-password_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> رمز عبور کمتز از 6 کارکتز نمیتواند باشد </div>")
	chk="false" 
}else{
	$("#re-password_e").html ("تکرار زمر عبور");
}

if (document.getElementById ("password").value!=''){
	if (document.getElementById ("re-password").value!=''){
		if (document.getElementById ("password").value!=document.getElementById ("re-password").value){
			$("#password_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> رمز عبورها مشابه نیستند </div>")
			$("#re-password_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'>رمز عبورها مشابه نیستند</div>")
			chk="false"
		}
	}
}


if (document.getElementById ("security_code").value==''){ $("#code_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'>تصویر امنیتی</div>");chk="false" }else {$("#code_e").html ("تصویر امنیتی")};

$('#erro').hide()

	if (chk=="false") { 
		$('#erro').text ("موارد مشخص شده اشکال دارند")
		$('#erro').show(1500)
		
		return false ;
		}else{
		return true ;
	}
}

function contact_us(){
var chk=false;
if (document.getElementById ("name").value==''){ $("#name_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> نام </div>");chk="false" }else{ $("#name_e").html ("نام ");}

if (document.getElementById ("email").value==''){ $("#email_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> ایمیل </div>");chk="false" }else{  $("#email_e").html (" ایمیل ");}


if (document.getElementById ("message").value==''){ $("#message_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> پیام </div>");chk="false" }else{  $("#message_e").html (" پیام ");}

$('#erro').hide()

	if (chk=="false") { 
		$('#erro').text ("موارد مشخص شده اشکال دارند")
		$('#erro').show(1500)
		
		return false ;
		}else{
		return true ;
	}


}

function check_send(){
var chk=false;
if (document.getElementById ("name").value==''){ $("#name_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> نام </div>");chk="false" }else{ $("#name_e").html ("نام ");}

if (document.getElementById ("email").value==''){ $("#email_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> ایمیل </div>");chk="false" }else{  $("#email_e").html (" ایمیل ");}

if (document.getElementById ("comment").value==''){ $("#comment_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> پیام </div>");chk="false" }else{  $("#comment_e").html ("پیام ");}

if (document.getElementById ("security_code").value==''){ $("#code_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'> کد امنیتی </div>");chk="false" }else{ 
	var code=document.getElementById ("security_code").value
	if (window.XMLHttpRequest) {     
      		req = new XMLHttpRequest();     
		}else if (window.ActiveXObject) {     
    		 req = new ActiveXObject("Microsoft.XMLHTTP");     
 		}     
		req.open('GET', "images/captccha/a.txt");
		req.onreadystatechange = function() {     
        if (req.readyState == 4) {
			if (req.responseText==code){
				$("#code_e").html ("تصویر امنیتی");
				}else{
				$("#code_e").html ("<div style='text-decoration:blink; font-weight:bold;color:#FF0000'>کد وارد شده صحیح نیست</div>");chk="false"
			}
		} }
		req.send("");	
	
}

$('#erro').hide()

	if (chk=="false") { 
		$('#erro').text ("موارد مشخص شده اشکال دارند")
		$('#erro').show(1500)
		
		return false ;
		}else{
		return true ;
	}

}


function check_login() {
$('#erro').hide()

	if($('#user_name').val()=='') {
		$('#erro').html("نام کاربری خود را وارد کنید"+ "<br/>")
		$('#erro').show(1500)
		return false;
	}else if(document.getElementById('user_name').value.length <5){
		$('#erro').html("نام کاربری کمتر از 5 کارکتر نمیتواند باشد"+ "<br/>")
		$('#erro').show(1500)
		return false;
	}
	if ($('#password').val()==''){
		$('#erro').html("<br/>" + "رمز عبور خود را وارد کنید")
		$('#erro').show(1500)
		return false;
	}else if(document.getElementById('password').value.length <6){
		$('#erro').html("<br/>" + "طول رمز کمتر از 6 کارکتر نمیتواند باشد")
		$('#erro').show(1500)
		return false;
	}
	
}


function f_adtype(){
if (document.getElementById ("ad_type").value=="متنی"){
	$('#uploading').hide (2000);
	document.getElementById ("n_star").disabled="disabled";
	document.getElementById ("upload").disabled="disabled";
	document.getElementById ("img_kind").style.filter="alpha(opacity=0)"
	}else{
	$('#uploading').show (2000);
	
	}
}

function f_imgkind(){
if (document.getElementById ("img_kind").value=="ستاره"){
	$('#uploading').show (2000);
	document.getElementById ("n_star").disabled="";
	
   }else{
	document.getElementById ("n_star").value="0";
   document.getElementById ("n_star").disabled="disabled";
   
}

if (document.getElementById ("ad_type").value=="متنی"){
	var a ="در نوع متنی تنها مجاز به انتخاب نوع عادی هستید"
	switch (document.getElementById ("img_kind").value){
		case "عادی" : 
		break;
		
		case "رایگان":
		break;
		
		default : alert(a)
		
	}
} 
} 

