Your IP : 10.10.0.253


Current Path : /var/www/components/com_formmaker/views/formmaker/tmpl/
Upload File :
Current File : /var/www/components/com_formmaker/views/formmaker/tmpl/main_div.js

F=2;//choices id

var c;

var a=new Array();

var rated=false;

function set_total_value(form_id)
{
if(wdformjQuery('.paypal_total'+form_id).length==0)
	return;
var div_paypal_show= wdformjQuery('.paypal_total'+form_id);
var div_paypal_products = wdformjQuery('.paypal_products'+form_id);
var div_paypal_tax = wdformjQuery('.paypal_tax'+form_id);
var input_paypal_total = wdformjQuery('.input_paypal_total'+form_id);
var total=0;
var total_shipping=0;
div_paypal_products.html('');

div_paypal_tax.html('');

n=parseInt(wdformjQuery('#counter'+form_id).val());
	
wdformjQuery("div[type='type_paypal_checkbox'], div[type='type_paypal_radio']").each(
	function()
	{
		id=wdformjQuery(this).parent().attr('wdid');
		
		wdformjQuery(this).find('input:checked').each(
		
			function()
			{
				label= wdformjQuery("label[for='"+wdformjQuery(this).attr('id')+"']").html();
				span_value = FormCurrency + wdformjQuery(this).val()+(wdformjQuery('#wdform_'+id+"_element_quantity"+form_id).length!=0 ? ' x'+wdformjQuery('#wdform_'+id+"_element_quantity"+form_id).val() : '');
				total =total + wdformjQuery(this).val() * parseInt((wdformjQuery('#wdform_'+id+"_element_quantity"+form_id).length!=0 ? wdformjQuery('#wdform_'+id+"_element_quantity"+form_id).val() : 1));
				div_paypal_products.html(div_paypal_products.html()+"<div>"+label+ ' - '+ span_value+"</div>");
			}
		);
	}
); 	

wdformjQuery("div[type='type_paypal_shipping']").each(
	function()
	{
		id=wdformjQuery(this).parent().attr('wdid');
		
		wdformjQuery(this).find('input:checked').each(
		
			function()
			{
				label= wdformjQuery("label[for='"+wdformjQuery(this).attr('id')+"']").html();
				span_value = FormCurrency + wdformjQuery(this).val()+(wdformjQuery('#wdform_'+id+"_element_quantity"+form_id).length!=0 ? ' x'+wdformjQuery('#wdform_'+id+"_element_quantity"+form_id).val() : '');
				total_shipping =total_shipping + wdformjQuery(this).val() * parseInt((wdformjQuery('#wdform_'+id+"_element_quantity"+form_id).length!=0 ? wdformjQuery('#wdform_'+id+"_element_quantity"+form_id).val() : 1));
				div_paypal_products.html(div_paypal_products.html()+"<div>"+label+ ' - '+ span_value+"</div>");
			}
		);
	}
); 	

wdformjQuery("div[type='type_paypal_select']").each(
	function()
	{
		id=wdformjQuery(this).parent().attr('wdid');
		if(wdformjQuery(this).find('select').val()!='')
		{
			label= wdformjQuery(this).find('select option:selected').html();
			span_value = FormCurrency + wdformjQuery(this).find('select').val()+(wdformjQuery('#wdform_'+id+"_element_quantity"+form_id).length!=0 ? ' x'+wdformjQuery('#wdform_'+id+"_element_quantity"+form_id).val() : '');
			total =total + wdformjQuery(this).find('select').val() * parseInt((wdformjQuery('#wdform_'+id+"_element_quantity"+form_id).length!=0 ? wdformjQuery('#wdform_'+id+"_element_quantity"+form_id).val() : 1));
			div_paypal_products.html(div_paypal_products.html()+"<div>"+label+ ' - '+ span_value+"</div>");
		}
	}
); 	

wdformjQuery("div[type='type_paypal_price']").each(
	function()
	{
		id=wdformjQuery(this).parent().attr('wdid');
		if(wdformjQuery('#wdform_'+id+"_element_dollars"+form_id).hasClass('input_active') || wdformjQuery('#wdform_'+id+"_element_cents"+form_id).hasClass('input_active'))
		{
			label= wdformjQuery(this).find('.wdform-label').html();
			cents='00';
			dollars='0';

			if( wdformjQuery('#wdform_'+id+"_element_dollars"+form_id).hasClass('input_active'))
				if(wdformjQuery('#wdform_'+id+"_element_dollars"+form_id).val()!='')
					dollars=wdformjQuery('#wdform_'+id+"_element_dollars"+form_id).val();
			
			if( wdformjQuery('#wdform_'+id+"_element_cents"+form_id).hasClass('input_active') && wdformjQuery('#wdform_'+id+"_element_cents"+form_id).val()!='')
				if(wdformjQuery('#wdform_'+id+"_element_cents"+form_id).val().length==1)
					cents='0'+wdformjQuery('#wdform_'+id+"_element_cents"+form_id).val();
				else 
					cents=wdformjQuery('#wdform_'+id+"_element_cents"+form_id).val();
					
			span_value = FormCurrency + dollars+'.'+cents;
			total =total +  parseFloat(dollars+'.'+cents);
			div_paypal_products.html(div_paypal_products.html()+"<div>"+label+ ' - '+ span_value+"</div>");
		}
	}
); 	

if(FormPaypalTax != 0)
	div_paypal_tax.html('Tax: ' + FormCurrency + (((total)*FormPaypalTax) / 100).toFixed(2));	
								
wdformjQuery('.div_total'+form_id).html(FormCurrency + (parseFloat((total *(1+FormPaypalTax/100)).toFixed(2))+total_shipping));	


input_paypal_total.val(FormCurrency + (parseFloat((total *(1+FormPaypalTax/100)).toFixed(2))+total_shipping))  ;	
}	

function check_isnum_or_minus(e)
{
   	var chCode1 = e.which || e.keyCode;
	if (chCode1 != 45 )
	{
    	if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
        return false;
	}	
	return true;
}

function sum_grading_values(num,form_id){

	var sum = 0;
	for(var k=0; k<100;k++)
	{
		if(document.getElementById(num+'_element'+form_id+'_'+k))
			if(document.getElementById(num+'_element'+form_id+'_'+k).value)
			{
				sum = sum+parseInt(document.getElementById(num+'_element'+form_id+'_'+k).value);
			}
			
        if(document.getElementById(num+'_total_element'+form_id)){
		if(sum > document.getElementById(num+'_total_element'+form_id).innerHTML){
		
		document.getElementById(num+'_text_element'+form_id).innerHTML =" "+ WDF_GRADING_TEXT+" " + document.getElementById(num+'_total_element'+form_id).innerHTML;
		}
		else{
		document.getElementById(num+'_text_element'+form_id).innerHTML="";
		}
		}
	}
	
	 if(document.getElementById(num+'_sum_element'+form_id))
	document.getElementById(num+'_sum_element'+form_id).innerHTML = sum;

}




function change_src(id,el_id,form_id,color){
	if(rated==false){
	for(var j=0;j<=id;j++)
	document.getElementById(el_id+'_star_'+j+'_'+form_id).src=JURI_ROOT+"/components/com_formmaker/images/star_"+color+'.png';
}
}


function reset_src(id,el_id, form_id){
	if(rated==false){
	for(var j=0;j<=id;j++)
	document.getElementById(el_id+'_star_'+j+'_'+form_id).src=JURI_ROOT+"/components/com_formmaker/images/star.png";
	}
}

function select_star_rating(id,el_id,form_id, color,star_amount)
{
	rated=true;
	for(var j=0;j<=id;j++)
		document.getElementById(el_id+'_star_'+j+'_'+form_id).src=JURI_ROOT+"/components/com_formmaker/images/star_"+color+".png";
	for(var k=id+1;k<=star_amount-1;k++)
		document.getElementById(el_id+'_star_'+k+'_'+form_id).src=JURI_ROOT+"/components/com_formmaker/images/star.png";
	document.getElementById(el_id+'_selected_star_amount'+form_id).value=id+1;
}


function show_other_input(num, form_id)
{
	for(k=0;k<50;k++)
		if(	document.getElementById(num+"_element"+form_id+k)) 
			if(	document.getElementById(num+"_element"+form_id+k).getAttribute('other')) 
				if(	document.getElementById(num+"_element"+form_id+k).getAttribute('other')==1)
				{
					element_other=document.getElementById(num+"_element"+form_id+k);
					break;
				}

	parent_=element_other.parentNode;



	var br = document.createElement('br');
		br.setAttribute("id", num+"_other_br"+form_id);

	var el_other = document.createElement('input');
		el_other.setAttribute("id", num+"_other_input"+form_id);
		el_other.setAttribute("name", num+"_other_input"+form_id);
		el_other.setAttribute("type", "text");
		el_other.setAttribute("class", "other_input");

	parent_.appendChild(br);
	parent_.appendChild(el_other);

}

function check_isnum(e)
{
  	var chCode1 = e.which || e.keyCode;

    if ( wdformjQuery.inArray(chCode1,[46,8,9,27,13,190]) != -1 || e.ctrlKey === true || (chCode1 >= 35 && chCode1 < 39))
        return true;

	if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
        return false;
	return true;
	
}


function captcha_refresh(id,genid)
{
	srcArr=document.getElementById(id+genid).src.split("&r=");
	document.getElementById(id+genid).src=srcArr[0]+'&r='+Math.floor(Math.random()*100);
	document.getElementById(id+"_input"+genid).value='';
	document.getElementById(id+genid).style.display="inline-block";
}

function set_checked(id,j,form_id)
{
	checking=document.getElementById(id+"_element"+form_id+j);
	if(checking.getAttribute('other'))
		if(checking.getAttribute('other')==1)
			if(!checking.checked)
			{					
				if(document.getElementById(id+"_other_input"+form_id))
				{
					document.getElementById(id+"_other_input"+form_id).parentNode.removeChild(document.getElementById(id+"_other_br"+form_id));
					document.getElementById(id+"_other_input"+form_id).parentNode.removeChild(document.getElementById(id+"_other_input"+form_id));
				}
				return false;					
			}
	return true;
}

function set_default(id, j, form_id){	
if(document.getElementById(id+"_other_input"+form_id))
	{
		document.getElementById(id+"_other_input"+form_id).parentNode.removeChild(document.getElementById(id+"_other_br"+form_id));
		document.getElementById(id+"_other_input"+form_id).parentNode.removeChild(document.getElementById(id+"_other_input"+form_id));
	}
}

function add_0(x)
{
	if(wdformjQuery(x).val().length==1)
		wdformjQuery(x).val('0'+wdformjQuery(x).val());
}

function check_hour(e, id, hour_interval)
{
   	var chCode1 = e.which || e.keyCode;
    	if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
        return false;
	hour=""+document.getElementById(id).value+String.fromCharCode(chCode1);

	hour=parseFloat(hour);
	if((hour<0) || (hour>hour_interval))
        	return false;
	return true;
} 

function check_minute(e, id)

{	

		

   	var chCode1 = e.which || e.keyCode;

    	if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))

        return false;

	minute=""+document.getElementById(id).value+String.fromCharCode(chCode1);



	minute=parseFloat(minute);

	if((minute<0) || (minute>59))

        	return false;

	return true;

} 



function check_second(e, id)

{	

		

   	var chCode1 = e.which || e.keyCode;

    	if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))

        return false;

	second=""+document.getElementById(id).value+String.fromCharCode(chCode1);



	second=parseFloat(second);

	if((second<0) || (second>59))

        	return false;

	return true;

} 



function check_isnum_interval(e, x, from, to)
{
   	var chCode1 = e.which || e.keyCode;
   	if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
        return false;
		
	val1=""+wdformjQuery(x).val()+String.fromCharCode(chCode1);
	
	if(val1.length>2)
        	return false;
	if(val1=='00')
        	return false;
	if((val1<from) || (val1>to))
        	return false;
	return true;
}

function change_year(x)
{
	year=wdformjQuery(x).val();
	from=parseFloat(wdformjQuery(x).attr('from'));
	to=parseFloat(wdformjQuery(x).attr('to'));
	year=parseFloat(year);
	if((year>=from) && (year<=to))
		wdformjQuery(x).val(year);
	else
		wdformjQuery(x).val('');
}

function check_day(e, x)
{	
   	var chCode1 = e.which || e.keyCode;
    if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
        return false;

	day=""+wdformjQuery(x).val()+String.fromCharCode(chCode1);
	if(day.length>2)
        	return false;
	if(day=='00')
        	return false;
	day=parseFloat(day);
	if((day<0) || (day>31))
        	return false;
	return true;
} 

function check_month(e, x)
{	
   	var chCode1 = e.which || e.keyCode;
   	if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
        return false;

	month=""+wdformjQuery(x).val()+String.fromCharCode(chCode1);
	if(month.length>2)
        	return false;
	if(month=='00')
        	return false;
	month=parseFloat(month);
	if((month<0) || (month>12))
        	return false;
	return true;
} 



function check_year1(e, x)
{	
   	var chCode1 = e.which || e.keyCode;
   	if (chCode1 > 31 && (chCode1 < 48 || chCode1 > 57))
        return false;

	year=""+wdformjQuery(x).val()+String.fromCharCode(chCode1);
	to=parseFloat(wdformjQuery(x).attr('to'));
	year=parseFloat(year);
	if(year>to)
        	return false;
	return true;
} 

function delete_value(x)
{
	ofontStyle=wdformjQuery(x).attr('class');
	if(ofontStyle.indexOf("input_deactive")!=-1)
	{
		wdformjQuery(x).val("").removeClass("input_deactive").addClass("input_active");
	}
}

function return_value(x)
{
	if(wdformjQuery(x).val()=="")
	{
		wdformjQuery(x).val(wdformjQuery(x).attr('title')).removeClass("input_active").addClass("input_deactive");
	}
}

function destroyChildren(node)

{
  while (node.firstChild)
      node.removeChild(node.firstChild);
}

////////////////////////////////////////////

function generate_page_nav(id, form_id, form_view_count, form_view_max)

{

form_view=id;

////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////

page_nav=document.getElementById(form_id+'page_nav'+id);

destroyChildren(page_nav);

form_view_elemet=document.getElementById(form_id+'form_view'+id);

remove_whitespace(form_view_elemet.parentNode.parentNode);

display_none_form_views_all(form_id);



generate_page_bar(id, form_id, form_view_count, form_view_max);



form_view_elemet.parentNode.style.display="";

		var td = document.createElement("div");
			td.setAttribute("valign", "middle");
			td.setAttribute("align", "left");
			td.style.display="table-cell";
			td.style.width="40%";
		

		page_nav.appendChild(td);


if(form_view_elemet.parentNode.previousSibling && form_view_elemet.parentNode.previousSibling.previousSibling)

{

	if(form_view_elemet.parentNode.previousSibling.tagName=="DIV")

		table=form_view_elemet.parentNode.previousSibling;

	else

		if(form_view_elemet.parentNode.previousSibling.previousSibling.tagName=="DIV")

			table=form_view_elemet.parentNode.previousSibling.previousSibling;

		else

			table="none";

			

	if(table!="none")

	{

		if(!table.firstChild.tagName)

			table.removeChild(table.firstChild);





		previous_title	= form_view_elemet.getAttribute('previous_title');

		previous_type	= form_view_elemet.getAttribute('previous_type');
		if(previous_type=="text")
			td.setAttribute("class", "previous-page");

		previous_class	= form_view_elemet.getAttribute('previous_class');

		previous_checkable	= form_view_elemet.getAttribute('previous_checkable');

	

		next_or_previous="previous";



		previous=make_pagebreak_button(next_or_previous, previous_title, previous_type, previous_class, previous_checkable, id, form_id, form_view_count, form_view_max);

		

		td.appendChild(previous);


	}

}





		var td = document.createElement("div");
			td.setAttribute("id", form_id+"page_numbers"+form_view);
			td.setAttribute("valign", "middle");
			td.setAttribute("class", "page-numbers");
			td.setAttribute("align", "center");
			td.style.display="table-cell";
//			td.style.width="100%";

			

if(document.getElementById(form_id+'pages').getAttribute('show_numbers')=="true")

{

		k=0;

		for(j=1; j<=form_view_max; j++)

		{

			if(document.getElementById(form_id+'form_view'+j))

			{

				k++;		

				if(j==form_view)

					page_number=k;

			}

		}

		

		var cur = document.createElement('span');

			cur.setAttribute("class", "page_numbers");

			cur.innerHTML=page_number+'/'+k;

		

		td.appendChild(cur);



}

		page_nav.appendChild(td);



			var td = document.createElement("div");
				td.setAttribute("valign", "middle");
				td.setAttribute("align", "right");
				td.style.cssText = "display:table-cell; width:40%; text-align:right;";
		
				page_nav.appendChild(td);

not_next=false;

if(form_view_elemet.parentNode.nextSibling)

{

	if(form_view_elemet.parentNode.nextSibling.tagName=="DIV" && form_view_elemet.parentNode.nextSibling.className=="wdform-page-and-images")

		table=form_view_elemet.parentNode.nextSibling;

	else

		if(form_view_elemet.parentNode.nextSibling.nextSibling)

		{

			if(form_view_elemet.parentNode.nextSibling.nextSibling.tagName=="DIV")

				table=form_view_elemet.parentNode.nextSibling.nextSibling;

			else

				table="none";

		}

			else

				table="none";

			

	if(table!="none")

	{

		next_title		=form_view_elemet.getAttribute('next_title');

		next_type		=form_view_elemet.getAttribute('next_type');
		if(next_type=="text")
				td.setAttribute("class", "next-page");

		next_class		=form_view_elemet.getAttribute('next_class');

		next_checkable	=form_view_elemet.getAttribute('next_checkable');

	

		next_or_previous="next";

	

		next=make_pagebreak_button(next_or_previous, next_title, next_type, next_class, next_checkable, id, form_id, form_view_count, form_view_max);

		

		td.appendChild(next);


	}

	else

	{

		not_next=true;

	}

}

else

{

	not_next=true;

}



	for(x=0; x<parseInt(document.getElementById('counter'+form_id).value); x++)

		if(document.getElementById(x+'_type'+form_id))

		{

			if(document.getElementById(x+'_type'+form_id).value=="type_map")

			{

				if_gmap_init(x, form_id);

				for(q=0; q<20; q++)

					if(document.getElementById(x+"_element"+form_id).getAttribute("long"+q))

					{

					

						w_long=parseFloat(document.getElementById(x+"_element"+form_id).getAttribute("long"+q));

						w_lat=parseFloat(document.getElementById(x+"_element"+form_id).getAttribute("lat"+q));

						w_info=parseFloat(document.getElementById(x+"_element"+form_id).getAttribute("info"+q));

						add_marker_on_map(x,q, w_long, w_lat, w_info, form_id,false);

					}

			}

			

			if(document.getElementById(x+'_type'+form_id).value=="type_mark_map")

			{      	

			   var longit = document.createElement('input');

					longit.setAttribute("type", 'hidden');

					longit.setAttribute("id", x+'_long'+form_id);

					longit.setAttribute("name",x+'_long'+form_id);



				var latit = document.createElement('input');

					latit.setAttribute("type", 'hidden');

					latit.setAttribute("id",x+'_lat'+form_id);

					latit.setAttribute("name",x+'_lat'+form_id);



				document.getElementById(x+"_element_section"+form_id).appendChild(longit);

				document.getElementById(x+"_element_section"+form_id).appendChild(latit);

			



				if_gmap_init(x, form_id);

				

				w_long=parseFloat(document.getElementById(x+"_element"+form_id).getAttribute("long0"));

				w_lat=parseFloat(document.getElementById(x+"_element"+form_id).getAttribute("lat0"));

				w_info=parseFloat(document.getElementById(x+"_element"+form_id).getAttribute("info0"));

			

				longit.value=w_long;

				latit.value=w_lat;

				add_marker_on_map(x,0, w_long, w_lat, w_info, form_id, true);

				

			}

			
	wdformjQuery('.wdform-element-section').each(function() {
		if(!wdformjQuery(this).parent()[0].style.width && parseInt(wdformjQuery(this).width())!=0)
		{
			
			if(wdformjQuery(this).css('display')=="table-cell")
			{
				if(wdformjQuery(this).parent().attr('type')!="type_captcha")
					wdformjQuery(this).parent().css('width', parseInt(wdformjQuery(this).width()) + parseInt(wdformjQuery(this).parent().find(wdformjQuery(".wdform-label-section"))[0].style.width)+15);
				else
					wdformjQuery(this).parent().css('width', (parseInt(wdformjQuery(this).parent().find(wdformjQuery(".captcha_input"))[0].style.width)*2+50) + parseInt(wdformjQuery(this).parent().find(wdformjQuery(".wdform-label-section"))[0].style.width)+15);
			}
		}
	
		if(parseInt(wdformjQuery(this)[0].style.width.replace('px', '')) < parseInt(wdformjQuery(this).css('min-width').replace('px', '')))
			wdformjQuery(this).css('min-width', parseInt(wdformjQuery(this)[0].style.width.replace('px', ''))-10);
	});
			

			

		}



wdformjQuery('.wdform-element-section').each(function() {
		if(!wdformjQuery(this).parent()[0].style.width && parseInt(wdformjQuery(this).width())!=0)
		{
	
			if(wdformjQuery(this).css('display')=="table-cell")
			{
				if(wdformjQuery(this).parent().attr('type')!="type_captcha")
					wdformjQuery(this).parent().css('width', parseInt(wdformjQuery(this).width()) + parseInt(wdformjQuery(this).parent().find(wdformjQuery(".wdform-label-section"))[0].style.width)+15);
				else
					wdformjQuery(this).parent().css('width', (parseInt(wdformjQuery(this).parent().find(wdformjQuery(".captcha_input"))[0].style.width)*2+50) + parseInt(wdformjQuery(this).parent().find(wdformjQuery(".wdform-label-section"))[0].style.width)+15);
			}
		}
		
	});	



		

////////////////////////////////////////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////////////////////////////////////

}

function display_none_form_views_all(form_id)

{

	for(t=1; t<30; t++)

		if(document.getElementById(form_id+'form_view'+t))

			document.getElementById(form_id+'form_view'+t).parentNode.style.display="none";

}

function generate_page_bar(form_view, form_id, form_view_count, form_view_max)	

{	

		if(document.getElementById(form_id+'pages').getAttribute('type')=='steps')

				make_page_steps_front(form_view, form_id, form_view_count, form_view_max);

		else

			if(document.getElementById(form_id+'pages').getAttribute('type')=='percentage')

				make_page_percentage_front(form_view, form_id, form_view_count, form_view_max);

			else

				make_page_none_front(form_id);

		



		

		

		if(document.getElementById(form_id+'pages').getAttribute('type')=='show_numbers')		

		{		

			td = document.getElementById(form_id+'page_numbers'+form_view);

			if(td)	

			{	

				destroyChildren(td);

				k=0;

				for(j=1; j<=form_view_max; j++)

				{

					if(document.getElementById(form_id+'form_view'+j))

					{

						k++;		

						if(j==form_view)

							page_number=k;

					}

				}

				

				var cur = document.createElement('span');

					cur.setAttribute("class", "page_numbers");

					cur.innerHTML=page_number+'/'+k;

				

				td.appendChild(cur);

				}

		}

		else

		{	

			td = document.getElementById(form_id+'page_numbers'+form_view);

			if(td)	

			{	

				destroyChildren(document.getElementById(form_id+'page_numbers'+form_view));

			}

		}		

	}

function make_page_steps_front(form_view, form_id, form_view_count, form_view_max)

{

	destroyChildren(document.getElementById(form_id+'pages'));

	show_title			=(document.getElementById(form_id+'pages').getAttribute('show_title')=='true');

	next_checkable		=(document.getElementById(form_id+'form_view'+form_view).getAttribute('next_checkable')=='true');

	previous_checkable	=(document.getElementById(form_id+'form_view'+form_view).getAttribute('previous_checkable')=='true');

	

	k=0;

	for(j=1; j<=form_view_max; j++)

	{	

		if(document.getElementById(form_id+'form_view'+j))

			{

			if(document.getElementById(form_id+'form_view'+j).getAttribute('page_title'))

				w_pages=document.getElementById(form_id+'form_view'+j).getAttribute('page_title');

			else

				w_pages=""

			k++;

			

			page_number = document.createElement('span');

			page_number.setAttribute('id','page_'+j);

			if(j<form_view)

				if(previous_checkable)

					page_number.setAttribute('onClick','if(check'+form_id+'('+form_view+')) generate_page_nav("'+j+'", "'+form_id+'", "'+form_view_count+'", "'+form_view_max+'")');

				else

					page_number.setAttribute('onClick','generate_page_nav("'+j+'", "'+form_id+'", "'+form_view_count+'", "'+form_view_max+'")');

				

				

			if(j>form_view)

				if(next_checkable)

					page_number.setAttribute('onClick','if(check'+form_id+'('+form_view+')) generate_page_nav("'+j+'", "'+form_id+'", "'+form_view_count+'", "'+form_view_max+'")');

				else			

					page_number.setAttribute('onClick','generate_page_nav("'+j+'", "'+form_id+'", "'+form_view_count+'", "'+form_view_max+'")');

			

			

			if(j==form_view)

				page_number.setAttribute('class',"page_active");

			else

				page_number.setAttribute('class',"page_deactive");

			if(show_title)

			{

				page_number.innerHTML=w_pages;

			}

			else

				page_number.innerHTML=k;

			

			document.getElementById(form_id+'pages').appendChild(page_number);

		}

	}



}

function make_page_percentage_front(form_view, form_id, form_view_count, form_view_max)
{
	destroyChildren(document.getElementById(form_id+'pages'));
	show_title=(document.getElementById(form_id+'pages').getAttribute('show_title')=='true');
    var div_parent = document.createElement('div');
       	div_parent.setAttribute("class", "page_percentage_deactive");

    var div = document.createElement('div');
       	div.setAttribute("id", "div_percentage");
       	div.setAttribute("class", "page_percentage_active");
       	div.setAttribute("align", "right");
		
    var div_arrow = document.createElement('div');
       	div_arrow.setAttribute("class", "wdform_percentage_arrow");
		
	var b = document.createElement('b');
       	b.setAttribute("class", "wdform_percentage_text");

	div.appendChild(b);
	
	k=0;
	cur_page_title='';
	for(j=1; j<=form_view_max; j++)
	{	
		if(document.getElementById(form_id+'form_view'+j))
			{
			if(document.getElementById(form_id+'form_view'+j).getAttribute('page_title'))
				w_pages=document.getElementById(form_id+'form_view'+j).getAttribute('page_title');
			else
				w_pages=""
			k++;
				
			if(j==form_view)
			{
				if(show_title)
				{ 
					var cur_page_title = document.createElement('div');
						cur_page_title.innerHTML=w_pages;
						
					cur_page_title.innerHTML=w_pages;										
					cur_page_title.setAttribute("class", "wdform_percentage_title");
				}
				page_number=k;

			}
		}
	}
	b.innerHTML=Math.round(((page_number-1)/k)*100)+'%';
	div.style.width=((page_number-1)/k)*100+'%';
	if(page_number==1)
		div_arrow.style.display='none';
	div_parent.appendChild(div);
	div_parent.appendChild(div_arrow);
	if(cur_page_title)
		div_parent.appendChild(cur_page_title);
	document.getElementById(form_id+'pages').appendChild(div_parent);
}

function make_page_none_front(form_id)
{
	destroyChildren(document.getElementById(form_id+'pages'));
}

function make_pagebreak_button(next_or_previous,title,type, class_, checkable, id, form_id, form_view_count, form_view_max)
{
	switch(type)
	{
		case 'text': {	

			var element = document.createElement('div');

				element.setAttribute('id', "page_"+next_or_previous+"_"+id);

				element.setAttribute('class', class_);

				if(checkable=="true")

					element.setAttribute('onClick', "if(check"+form_id+"("+id+")) page_"+next_or_previous+"("+id+","+form_id+","+form_view_count+","+form_view_max+")");

				else

					element.setAttribute('onClick', "page_"+next_or_previous+"("+id+","+form_id+","+form_view_count+","+form_view_max+")");

				element.innerHTML=title;

				

			return element;

			

			break;

		}

		case 'img':{ 			

		

			var element = document.createElement('img');

				element.setAttribute('id', "page_"+next_or_previous+"_"+id);

				element.setAttribute('class', class_);

				if(checkable=="true")

					element.setAttribute('onClick', "if(check"+form_id+"("+id+")) page_"+next_or_previous+"("+id+","+form_id+","+form_view_count+","+form_view_max+")");

				else

					element.setAttribute('onClick', "page_"+next_or_previous+"("+id+","+form_id+","+form_view_count+","+form_view_max+")");

				if(title.indexOf("http")==0)

				{

					element.src=title;

				}

				else

					element.src=JURI_ROOT+'/'+title;

				

			return element;

			

			break;

		}

	}

}

function form_maker_findPos(obj) {
  var curtop = 0;
  if (obj.offsetParent) {
    do {
        curtop += obj.offsetTop;
    } while (obj = obj.offsetParent);
  return [curtop];
  }
}

function page_previous(id, form_id, form_view_count, form_view_max)

{

	form_view_elemet=document.getElementById(form_id+'form_view'+id);

	if(form_view_elemet.parentNode.previousSibling && form_view_elemet.parentNode.previousSibling.previousSibling)

	{

	if(form_view_elemet.parentNode.previousSibling.tagName=="DIV")

		table=form_view_elemet.parentNode.previousSibling;

	else

		table=form_view_elemet.parentNode.previousSibling.previousSibling;

	}

	if(!table.firstChild.tagName)

		table.removeChild(table.firstChild);


	generate_page_nav(table.firstChild.id.replace(form_id+'form_view', ""),form_id, form_view_count, form_view_max);
	window.scroll(0, form_maker_findPos(document.getElementById("form" + form_id)));

}



function page_next(id, form_id, form_view_count, form_view_max)

{

	form_view_elemet=document.getElementById(form_id+'form_view'+id);

	if(form_view_elemet.parentNode.nextSibling)

	{

	if(form_view_elemet.parentNode.nextSibling.tagName=="DIV")

		table=form_view_elemet.parentNode.nextSibling;

	else

		table=form_view_elemet.parentNode.nextSibling.nextSibling;

	}

	if(!table.firstChild.tagName)

		table.removeChild(table.firstChild);

	generate_page_nav(table.firstChild.id.replace(form_id+'form_view', ""), form_id, form_view_count, form_view_max);
	window.scroll(0, form_maker_findPos(document.getElementById("form" + form_id)));

}


function getfileextension(filename, exten) 
{ 
	if( filename.length == 0 ) 
	return true; 
	var dot = filename.lastIndexOf("."); 
	var extension = filename.substr(dot+1,filename.length); 
	exten=exten.split(',');
	for(var j=0 ; j<exten.length; j++)
	{
		exten[j]=exten[j].replace(/\./g,'');
		exten[j]=exten[j].replace(/ /g,'');
		if(extension.toLowerCase()==exten[j].toLowerCase())
		return true;
	}
	return false; 
} 

function reselect(select, addclass) {
    addclass = typeof(addclass) != 'undefined' ? addclass : '';
    wdformjQuery(select).wrap('<div class="sel-wrap ' + addclass + '"/>');
    var sel_options = '';
    var selected_option = false;
    wdformjQuery(select).children('option').each(function() {
        if(wdformjQuery(this).is(':selected')){
            selected_option = wdformjQuery(this).index();
        }
        sel_options = sel_options + '<div class="sel-option" value="' + wdformjQuery(this).val() + '">' + wdformjQuery(this).html() + '</div>';

    });
	
	w=wdformjQuery(select)[0].style.width;
	
	if(w=='100%')
		w='100%';
	else
		w=(wdformjQuery(select).width()+32)+'px';

	var sel_imul = '<div class="sel-imul" style="width:'+w+'">\
                <div class="sel-selected">\
                    <div class="selected-text">' + wdformjQuery(select).children('option').eq(selected_option).html() + '</div>\
                    <div class="sel-arraw"></div>\
                </div>\
                <div class="sel-options">' + sel_options + '</div>\
            </div>';
			
	wdformjQuery(select).addClass('no-width');
    wdformjQuery(select).before(sel_imul);
}


wdformjQuery('.wdform-element-section select').live('change', function() {


var tektext = wdformjQuery(this).children("option:selected").text();
wdformjQuery(this).parent('.sel-wrap ').children('.sel-imul').children('.sel-selected').children('.selected-text').html(tektext);
wdformjQuery(this).parent('.sel-wrap ').children('.sel-imul').children('.sel-options').children('.sel-option').removeClass('sel-ed');
wdformjQuery(this).addClass('sel-ed');

wdformjQuery(this).parent('.sel-wrap ').children('.sel-imul').children('.sel-options').each(function() {
if (wdformjQuery(this).html() == tektext) {

wdformjQuery(this).addClass('sel-ed');
}
});

});

wdformjQuery('.sel-imul').live('click', function() {

    wdformjQuery('.sel-imul').removeClass('act');
    wdformjQuery(this).addClass('act');
    if (wdformjQuery(this).children('.sel-options').is(':visible')) {
        wdformjQuery('.sel-options').hide();
    }
    else {
        wdformjQuery('.sel-options').hide();
        wdformjQuery(this).children('.sel-options').show();
		wdformjQuery(this).children('.sel-options').css('width',wdformjQuery(this).width());
    }
});

wdformjQuery('.sel-option').live('click', function() {

    var tektext = wdformjQuery(this).html();
    wdformjQuery(this).parent('.sel-options').parent('.sel-imul').children('.sel-selected').children('.selected-text').html(tektext);

    wdformjQuery(this).parent('.sel-options').children('.sel-option').removeClass('sel-ed');
    wdformjQuery(this).addClass('sel-ed');

    var tekval = wdformjQuery(this).attr('value');
	
    tekval = typeof(tekval) != 'undefined' ? tekval : tektext;
  wdformjQuery(this).parent('.sel-options').parent('.sel-imul').parent('.sel-wrap').children('select').children('option').removeAttr('selected').each(function() {
        if (wdformjQuery(this).html() == tektext) {
            
            wdformjQuery(this).attr('selected', 'select');
        }
    });
	
	wdformjQuery(this).parent('.sel-options').parent('.sel-imul').parent('.sel-wrap').children('select').change();
});

var selenter = false;
wdformjQuery('.sel-imul').live('mouseenter', function() {
    selenter = true;
});

wdformjQuery('.sel-imul').live('mouseleave', function() {
    selenter = false;
});

wdformjQuery(document).click(function() {
    if (!selenter) {
        wdformjQuery('.sel-options').hide();
        wdformjQuery('.sel-imul').removeClass('act');
    }
});

function remove_whitespace(node)
{
var ttt;
	for (ttt=0; ttt < node.childNodes.length; ttt++)
	{
        if( node.childNodes[ttt] && node.childNodes[ttt].nodeType == '3' && !/\S/.test(  node.childNodes[ttt].nodeValue ))
		{
			
			node.removeChild(node.childNodes[ttt]);
			 ttt--;
		}
		else
		{
			if(node.childNodes[ttt].childNodes.length)
				remove_whitespace(node.childNodes[ttt]);
		}
	}
	return
}