var oneatleast = false;

function frmvote(frm) {
	for(n=0;n< frm.vote.length ;n++) {
		if(frm.vote[n].checked) {
			v = frm.vote[n].value;
			oneatleast = true
		}
	}
	if(oneatleast) {
		window.open("vote.php?id="+frm.id.value+"&option="+v,"vote_window" , "resizable=yes , menubar =no ,toolbar =no , width=640,height=320");
	}else{
		//window.open("vote.php?id="+frm.id.value+"&option="+v,"vote_window");
	}
	return false;
}


ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='images/plus.gif' class='statusicon' />", "<img src='images/minus.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})



function ShowComments(data_type, data_id){
	
	$("#comments").html("<img src='images/loader.gif'>");
	$.ajax({
		url: "comments.html",
		type:"POST",
		async: true,
		data:{
			clean: 1, 
			id: data_id, 
			type: data_type
		},
		beforeSend: function (XMLHttpRequest) {
			
		},
		success: function(html){
			$("#comments").html(html);
		},
		error: function (XMLHttpRequest, textStatus, errorThrown) {
		
		}
	});

}

function MM_validateForm() { //v4.0
  if (document.getElementById){
    var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
    for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]);
      if (val) { nm=val.name; if ((val=val.value)!="") {
        if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
          if (p<1 || p==(val.length-1)) errors+='- '+nm+' يجب ان يحتوي علي بريد اليكتروني صالح.\n';
        } else if (test!='R') { num = parseFloat(val);
          if (isNaN(val)) errors+='- '+nm+' يجب ان يحتوي علي رقم.\n';
          if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
            min=test.substring(8,p); max=test.substring(p+1);
            if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
      } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' حقل مطلوب.\n'; }
    } if (errors) alert('من فضلك تأكد من الحقول التالية:\n'+errors);
    document.MM_returnValue = (errors == '');
} }

function ap_stopAll(vab){
	
}
/*
<script type='text/javascript'>
var so = new SWFObject("JW_FlashPlayer/player_4_5.swf","player","550","470","9","#FFFFFF");
so.addParam('allowscriptaccess','always');
so.addParam('allowfullscreen','true');
so.addVariable('respectduration', 'true');
so.addVariable('file', vedio.flv');
so.addVariable('autostart', 'true');
so.write('container');

function playerReady(obj){ 	
var player = document.getElementById(obj.id);
player.addModelListener('TIME','timeTracker');
}
function timeTracker(obj) { 
if(obj.position > 10 )
eventhandle('break')
};
</script>

*/