//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" or "mouseover
//	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: ["noneclass", "noneclass"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
//	togglehtml: ["prefix", "<img src='/image/icon_mainmenu_plus.gif' class='statusicon' border='0'/>", "<img src='/image/icon_mainmenu_minus.gif' class='statusicon' border='0'/>"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
//	animatespeed: "normal", //speed of animation: "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
//	}
//})

$(document).ready(function(){
           
   $(".li_rolls").each(function(){
		var id	  = $(this).attr("infos");
		
		var infos_li = $.cookie('rolls_'+ id );
		
		if( infos_li != null && typeof(infos_li) != "undefined" ){
			
			//infos_arr = infos_li.split(",");
			
			//var rate = Math.ceil(parseInt(infos_arr[0])  /  ( parseInt(infos_arr[0]) + parseInt(infos_arr[1]) ) * 100);
			//$(this).html( 'Success: ' + rate + '% <a><img src="/image/supported.gif" border=0></a> <a><img src="/image/againsted.gif" border=0></a>');
			$(this).empty();
			$(this).parent().find(".li_rolls_block").empty();
		}else{
			//if( typeof(id_arr) == 'undefined' ){
			//	id_arr	=	new Array();
			//}
			//id_arr.push(id);
		}
	});

   $(".rolls").click(  
		function () {

		   var dollArrs = $(this).attr("infos").split(",");
		   var dollArr  = {'style':dollArrs[0],'id':dollArrs[1],'value':dollArrs[2],'act':1};
		   
		   var obj		=	this;

		  $.ajax({
			   type: "POST",
			   url: "/front/polls.php",
			   data: $.param(dollArr),
			   success: function(msg){
				   json	=	eval("("+msg+")");
				   
				   if( isNaN(json.count[0]) ){
						json.count[0] = 0;   
				   }
				   
				   if( isNaN(json.count[1]) ){
						json.count[1] = 0;   
				   }

				   $.cookie('rolls_'+json.id,json.count[0] +','+json.count[1],{ expires: 7, path: '/', domain: 'IrelandVoucherCodes.com'});
				   
				  //var rate = Math.ceil(parseInt(json.count[0])  /  ( parseInt(json.count[0]) + parseInt(json.count[1]) ) * 100);
				  
				  var objp = $(obj).parent();
				  
				  $(obj).parent().fadeOut("slow",function(){
						$(this).css('background-color','EFFEFF');
						$(obj).parent().html(" Thank you for voting ");
				  });
				  
				  $(objp).fadeIn("slow");
				  
				  $(objp).fadeOut("slow",function(){
					  $(objp).css('background-color','');
					  //$(objp).html( 'Success: ' + rate + '% <a><img src="/image/supported.gif" border=0></a> <a ><img src="/image/againsted.gif" border=0></a>');	
					  $(objp).empty();
					  $(objp).parent().find(".li_rolls_block").empty();

				  });
				   
				  //$(objp).fadeIn("slow");

			   }
		  });

		}
   ); 

})

function verify_id(id){
	var verifyArr  = {'id':id,'act':'verify_action'};
	$("#verify_msg").html("Verifying...");
	
	 $.ajax({
			type: "POST",
			url: "/front/merchant_portal_verify.php",
			data: $.param(verifyArr),
			success: function(msg){
				json	=	eval("("+msg+")");
				if( json.status == false){
					$("#verify_msg").html(' <p><span style="color:#FF0000">Verified failed</span>, the verified file cannot be found in your site, please try again.</p>');
				}else{
					$("#verify_msg").html('<p><span style="color:#009900">Verified successfully</span>, our editorial team will review your submission soon and your store would show up in next several days.</p>');	
				}
			}
	});
}


