AQS={};var $j = jQuery.noConflict(); window.$j.aqs=AQS;if(!window.console||!console.firebug){var names=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];window.console={};for(var i=0;i<names.length;++i){window.console[names[i]]=function(){}}}
AQS.m_package=false;AQS.Try=function(){for(var i=0;i<arguments.length;i++){try{return arguments[i]();}catch(e){}}
return null;}
AQS.exceptionMessage=function(p_exception){if(p_exception.message!=undefined){return p_exception.message;}else{return p_exception;}}
function AQSPath(p_file_path){g_required_paths[g_required_paths.length]=p_file_path;}
function AQSFetchAndExec(p_js_url){try{var l_js_url=p_js_url;var l_transport=AQS.Try
(function(){return new ActiveXObject('Msxml2.XMLHTTP')},function(){return new ActiveXObject('Microsoft.XMLHTTP')},function(){return new XMLHttpRequest()});try{l_transport.open("GET",l_js_url,false);l_transport.send(null);}catch(l_e){trace("GET failed to load from "+l_js_url+" "+AQS.exceptionMessage(l_e));var l_script='<script language="JavaScript" type="text/javascript" src="'+l_js_url+'"><\/script>';document.write(l_script);return true;}
if(l_transport.readyState==4){try{eval(l_transport.responseText);return true;}catch(l_e){error("EVAL failed to load from "+l_js_url+" "+AQS.exceptionMessage(l_e));return false;}}}catch(l_e){error("UNKNOWN failure loading from "+p_js_url+" "+AQS.exceptionMessage(l_e));}
return false;}
function AQSInclude(p_filename)
{if(AQS.m_package)
{return;}
if(p_filename.indexOf("/")!=-1)
{return AQSFetchAndExec(p_filename);}
else
{for(var l_path=g_required_paths.length-1;l_path>=0;l_path--)
{if(AQSFetchAndExec(g_required_paths[l_path]+p_filename))
{return true;}}}
error("Unable to locate \""+p_filename+"\"");return false;}
String.prototype.escape_html=function(){return this.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;");}
String.prototype.trim=function(){return this.replace(/^\s+/,'').replace(/\s+$/,'');}
AQS.Config={};AQS.Config.PROFILES={development:{domain:'ci.bestpartyever.com',site_url:'http://ci.bestpartyever.com',image_url:'http://gfxtest.bestpartyever.com/gfx',ssl_url:'https://ci.bestpartyever.com'},production:{domain:'bestpartyever.com',site_url:'http://bestpartyever.com',image_url:'http://gfx.bestpartyever.com/gfx',ssl_url:'https://bestpartyever.com'}}
AQS.Base={};Base_ItemList=function(type){return{m_state:0,m_item_id:0,m_item_type:type||"",m_list:{},e_item_state_handler:function(state){return null;},add:function(id,data){if(!data||!id||!this.m_list||this.m_list[id])
return false;this.m_list[id]=data;return true;},remove:function(id){if(!id)
return false;try{delete this.m_list[id];return true;}catch(e){return false;}},get:function(id){if(!id)
return false;try{return this.m_list[id];}catch(e){return false;}},getState:function(){return this.m_state;},setState:function(state){this.m_state=state;this.e_item_state_handler(state);},getItemId:function(id){return this.m_list[id];},setItemId:function(id){this.m_item_id=id;},getType:function(){return this.m_item_type;},setType:function(type){this.m_item_type=type;}}}
AQS.Base.ItemList=Base_ItemList;AQS.Base.Money={};AQS.Base.Money.formatCurrency=function(num){num=num.toString().replace(/\$j|\,/g,'');if(isNaN(num))
num="0";sign=(num==(num=Math.abs(num)));num=Math.floor(num*100+0.50000000001);cents=num%100;num=Math.floor(num/100).toString();if(cents<10)
cents="0"+cents;for(var i=0;i<Math.floor((num.length-(1+i))/3);i++)
num=num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));return(((sign)?'':'-')+'$j'+num+'.'+cents);};AQS.Base.Number={};AQS.Base.Number.formatPercent=function(num){num=Math.floor(num*100);return num+'%';}
AQS.Base.JSON={};function string_to_json(s){var _ojs="";if(/["\\\x00-\x1f]/.test(s)){return'"'+s.replace(/[\x00-\x1f\\"]/g,function(a){var c=m[a];if(c){return c;}
c=a.charCodeAt();return'\\u00'+
Math.floor(c/16).toString(16)+
(c%16).toString(16);})+'"';}
return'"'+s+'"';}
function boolean_to_json(b){var _ojs="";if(b){_ojs="true";}else{_ojs="false";}
return _ojs;}
function object_to_json(o){var _ojs="";for(v in o){_ojs+=v+" : "+to_json(o[v])+",";}
_ojs=_ojs.slice(0,_ojs.length-1);return _ojs;}
function array_to_json(a){var _ojs="";for(var i=0;i<a.length;i++){_ojs+=to_json(a[i])+',';}
_ojs=_ojs.slice(0,_ojs.length-1);return _ojs;}
AQS.Base.JSON.to_json=function(o){var _ojs="";switch(typeof o){case'object':if(o){_ojs+='{'+object_to_json(o)+'}';}else{_ojs+='{null}';}
break;case'array':if(o){_ojs+='['+array_to_json(o)+']';}else{_ojs+='[null]';}
case'string':_ojs+=string_to_json(o);break;case'number':_ojs+=number_to_json(o);break;case'boolean':_ojs+=boolean_to_json(o);break;}
return _ojs;}
AQS.Base.UI={};
AQS.Base.UI.Form={inPlaceEdit:function(options){var settings={url:options.url||"",params:options.params||"",args:options.args||{},field_type:options.field_type||"input",select_options:options.select_options||"",textarea_cols:options.textarea_cols||"25",textarea_rows:options.textarea_rows||"10",class_over:options.class_over||"inline_over",class_out:options.class_out||"inline_out",saving_text:options.saving_text||"Saving...",saving_image:options.saving_image||"",default_text:options.default_text||"(Click here to add text)",after_default:options.after_default||false,select_text:options.select_text||"Choose new value",text_size:options.text_size||10,class_name:options.class_name||null,value_required:options.value_required||null,element_id:options.element_id||"element_id",update_value:options.update_value||"update_value",original_html:options.original_html||"original_html",save_button:options.save_button||'<img src="'+AQS.settings.image_url+'/buttons/accept.png" class="inplace_save" style="padding-top: 2px"/>',cancel_button:options.cancel_button||'<img src="'+AQS.settings.image_url+'/buttons/cancel.png" class="inplace_cancel" style="padding-top: 2px"/>',callback:options.callback||null,success:options.success||null,error:function(request){console.log("Failed to save value: "+request.responseText||'Unspecified Error');}}
return $j(this).each(function(){var editing=false;var click_count=0;var original_element=jQuery(this);jQuery(this).mouseover(function(){jQuery(this).addClass("inline_over");jQuery(this).removeClass("inline_out");}).mouseout(function(){jQuery(this).removeClass("inline_over");jQuery(this).addClass("inline_out");}).click(function(){click_count++;if(!editing){editing=true;var original_html=jQuery(this).html();var buttons_code=settings.save_button+' '+settings.cancel_button;if(original_html==settings.default_text)jQuery(this).html('');switch(settings.field_type){case"textarea":var use_field_type='<textarea name="inplace_value" rows="'+settings.textarea_rows+'" cols="'+settings.textarea_cols+'">'+jQuery(this).text().trim().escape_html()+'</textarea>';break;case"input":var use_field_type='<input type="text" size="'+settings.text_size+'" name="inplace_value"';if(settings.class_name)
use_field_type+=' class="'+settings.class_name+'"';use_field_type+=' value="'+
jQuery.trim(jQuery(this).text()).escape_html()+'" />';break;case"select":var optionsArray=settings.select_options.split(',');var use_field_type='<select name="inplace_value"><option value="">'+
settings.select_text+'</option>';for(var i=0;i<optionsArray.length;i++){var optionsValuesArray=optionsArray[i].split(':');var use_value=optionsValuesArray[1]||optionsValuesArray[0];var selected=use_value==original_html?'selected="selected" ':'';use_field_type+='<option '+selected+'value="'+use_value.trim().escape_html()+'">'+
optionsValuesArray[0].trim().escape_html()+'</option>';}
use_field_type+='</select>';break;}
jQuery(this).html('<form onsubmit="return false;" class="inplace_form" style="display: inline; margin: 0; padding: 0;">'+
use_field_type+' '+buttons_code+'</form>');}
if(click_count==1){original_element.children("form").children(".inplace_cancel").click(function(){editing=false;click_count=0;original_element.css("background",settings.bg_out);original_element.html(original_html);return false;});original_element.children("form").children(".inplace_save").click(function(){original_element.css("background",settings.bg_out);var new_html=jQuery(this).parent().children(0).val();if(settings.saving_image!=""){var saving_message='<img src="'+settings.saving_image+'" alt="Saving..." />';}else{var saving_message=settings.saving_text;}
original_element.html(saving_message);if(settings.params!=""){settings.params="&"+settings.params;}
if(settings.callback){html=settings.callback(original_element.attr("id"),new_html,original_html,settings.params);editing=false;click_count=0;if(html){original_element.html(html||new_html);}else{console.log("Failed to save value: "+new_html);original_element.html(original_html);}}else if(settings.value_required&&new_html==""){editing=false;click_count=0;original_element.html(original_html);console.log("Error: You must enter a value to save this field");}else{jQuery.ajax({url:settings.url,type:"POST",data:encodeURIComponent(settings.update_value)+'='+encodeURIComponent(new_html)+'&'+settings.element_id+'='+
original_element.attr("id")+settings.params+'&'+settings.original_html+'='+original_html,dataType:"html",complete:function(request){editing=false;click_count=0;},success:function(html){var new_text=html||settings.default_text;if(settings.after_default)
original_element.html(original_html);else
original_element.html(new_text);if(settings.success)settings.success(html,original_element,settings.args);},error:function(request){original_element.html(original_html);if(settings.error)settings.error(request,original_element);}});}
return false;});}});});},openGuestPane:function(options){var settings={url:options.url||"",pane:$j(options.pane),params:options.params||"",callback:options.callback||null,success:options.success||null,error:function(request){console.log("Failed to load Form: "+request.responseText||'Unspecified Error');}}
return $j(this).each(function(){jQuery.ajax({url:settings.url,type:"POST",data:settings.params,dataType:"html",complete:function(request){},success:function(html){if(settings.success)settings.success(html);settings.pane.html(html);settings.pane.toggleClass("hide");},error:function(request){if(settings.error)settings.error(request);}});});}}
$j.fn.inPlaceEdit=AQS.Base.UI.Form.inPlaceEdit;
AQS.Base.UI.Basket={};AQS.Base.UI.Basket=function(types){this.baskets=new Object();baskets=this.baskets;$j.each(types,function(i,n){baskets[n]=new Base_ItemList(n);});return{baskets:this.baskets,Item:AQS.Base.UI.Basket.Item,remove:function(type,id,_h){if(!type||!id||!_h)
return false;b=this.baskets[type];b.e_item_state_handler=_h;b.setState(0);return b.remove(id);},add:function(type,data,_h){if(!data||!_h||!type)
return false;b=this.baskets[type];if(!b)
return false;b.e_item_state_handler=_h;b.setState(1);for(l_x in data)
b.add(l_x,data[l_x]);return true;},get:function(type,id){if(!id||!type)
return false;try{b=this.baskets[type];return b.get(id);}catch(e){return false;}},toJSON:function(type){if(!type)
return false;b=this.baskets[type];if(!b)return false;b.m_list.toJSONString();}}}
AQS.Base.UI.Budget={};AQS.Base.UI.Budget={initialize:function(types){this.item_list=new Object();item_list=this.item_list;$j.each(types,function(i,n){item_list[n]=new Base_ItemList(n);});return{item_list:this.item_list,Item:AQS.Base.UI.Budget.Item,remove:function(type,id,_h){if(!type||!id||!_h)
return false;b=this.item_list[type];b.e_item_state_handler=_h;b.setState(0);return b.remove(id);},add:function(type,data,_h){if(!data||!_h||!type)
return false;b=this.item_list[type];if(!b)
return false;b.e_item_state_handler=_h;b.setState(1);for(l_x in data)
b.add(l_x,data[l_x]);return true;},get:function(type,id){if(!id||!type)
return false;try{b=this.item_list[type];return b.get(id);}catch(e){return false;}},toJSON:function(type){if(!type)
return false;b=this.item_list[type];if(!b)return false;b.m_list.toJSONString();},estimatedTotal:function(){var total=0;for(var a in this.item_list){for(var b in this.item_list[a].m_list){total+=parseFloat(this.item_list[a].m_list[b].estimate);}}
return total;}}},build:function(options){return this.each(function(){var el=this;el.config={budget_list:options.budget_list||{1:"custom",2:"vendor"},budget_data:options.budget_data||{1:{name:"",estimate:"0.00",id:"1",type:"custom",row_id:1},2:{name:"",estimate:"0.00",id:"2",type:"custom",row_id:2},3:{name:"",estimate:"0.00",id:"3",type:"custom",row_id:3}},total_budget:options.total_budget||"0.00"};el.manager={addBudgetItem:function(type,name,vendor_id,i,_h){_id=el.ajax.insertBudgetItem(type,vendor_id);a=el.display.addItem(type,name,_id)
if(typeof(_h)!="undefined")
return _h(i);return true;}};el.display={updateBudgetDisplay:function(){var _e=budget.estimatedTotal();var _result=total_budget_el.attr("value")-_e;var _result_p=1;var _result_i=0;var a=0;if(_e>0&&parseFloat(total_budget_el.attr("value"))!=0){_result_p=1.00-(Math.round(_e*100)/100)/(Math.round(total_budget_el.attr("value")*100)/100);}else if(parseFloat(total_budget_el.attr("value"))==0){_result_p=0;}else{_result_p=1;}
remaining_budget_el.text(AQS.Base.Money.formatCurrency(_result));remaining_percent_el.text(AQS.Base.Number.formatPercent(_result_p));if(_result_p<=0)
remaining_percent_el.css({color:'red'})
else
remaining_percent_el.css({color:'#17BA17'});if(_result<=0)
remaining_budget_el.css({color:'red'});else
remaining_budget_el.css({color:'#17BA17'});$j('#customList tbody tr',el).each(function(){a++;_result_i=0;_data_i=el.config.budget_data[a].estimate;if(parseFloat(total_budget_el.attr("value"))!=0)
_result_i=(Math.round(_data_i*100)/100)/(Math.round(total_budget_el.attr("value")*100)/100)||0;if(_result_i>1)
$j('.budget',this).css({color:'red'});else
$j('.budget',this).css({color:'#17BA17'});$j('.budget',this).text(AQS.Base.Number.formatPercent(_result_i));$j(this).removeClass("even odd");$j(this).addClass((a%2)?'even':'odd');});},buildItem:function(class_v,a,type,name){return"<tr "+class_v+" id='cb_item_"+a+"'><td class='itemName'>"+((type=="custom")?("<input type='text' name='name' />"):(name))+"</td><td class='estimate USD'>$j <input type='text' value='' size='5' name='estimate' /></td><td class='budget USD'>%</td><td class='delete'><img src='"+AQS.settings.image_url+"/buttons/delete.png' alt='delete item' /></td></tr>";},addItem:function(type,_name,_id){var a=++custom_length;var l_obj={};var n_el={};var es_el={};var name_el={};l_obj[a]={name:_name,estimate:"0.00",type:type,id:_id,row_id:a};el.config.budget_data[a]=l_obj[a];class_v="class='"+((a%2)?'even':'odd')+"'";$j("#customList tbody",el).append(el.display.buildItem(class_v,a,type,_name));n_el=$j("#cb_item_"+a);if(!n_el){return false;}
es_el=$j("input[name='estimate']",n_el)
name_el=$j("input[name='name']",n_el)
$j.data(es_el.get(0),"estimate",el.config.budget_data[a]);es_el.attr("value",el.config.budget_data[a].estimate);name_el.attr("value",el.config.budget_data[a].name);name_el.change(function(){d=$j.data($j(this).parent().parent().children('td.estimate').children('input').get(0),"estimate");el.ajax.updateBudgetItem(d.id,"name",this.value);});es_el.keyup(function(e){if(this.value>1000000||this.value<0){remaining_budget_el.text("N/A");remaining_percent_el.text("N/A");}else if((e.which>=0&&e.which<=31)||(e.which==46)||(e.which>=48&&e.which<=57)||(e.which>=96&&e.which<=110)){$j.data(this,"estimate").estimate=this.value;el.display.updateBudgetDisplay();d=$j.data(this,"estimate");el.ajax.updateBudgetItem(d.id,"estimate",d.estimate);}});es_el.keypress(function(e){if((e.which>=0&&e.which<=31)||(e.which==46)||(e.which>=48&&e.which<=57)||(e.which>=96&&e.which<=110)||(e.which>=37&&e.which<=40)){return true}else{return false;}});$j('.delete img',n_el).click(function(){d=$j.data($j(this).parent().parent().children('td.estimate').children('input').get(0),"estimate");el.ajax.removeBudgetItem(d.id,type);$j(this).parents('tr').remove();budget.remove(type,d.row_id,function(){});el.display.updateBudgetDisplay();});budget.add(type,l_obj,function(){el.display.updateBudgetDisplay();});return a;}};el.ajax={updateBudget:function(value){_url=AQS.settings.site_url+'/db/parties/update_budget';_data="value="+encodeURIComponent(value);return $j.ajax({type:"POST",url:_url,data:_data,success:function(msg){}});},removeBudgetItem:function(id,type){_url=AQS.settings.site_url+'/db/parties/remove_budget_item';_data="id="+encodeURIComponent(id)+"&type="+encodeURIComponent(type);return $j.ajax({type:"POST",url:_url,data:_data,success:function(msg){}});},updateBudgetItem:function(id,type,value){_url=AQS.settings.site_url+'/db/parties/update_budget_item';_data="id="+encodeURIComponent(id)+"&type="+encodeURIComponent(type)+"&value="+encodeURIComponent(value);return $j.ajax({type:"POST",url:_url,data:_data,success:function(msg){}});},insertBudgetItem:function(type,vendor,name,value){var _id=0;_url=AQS.settings.site_url+'/db/parties/insert_budget_item';_data="type="+encodeURIComponent(type);if(vendor)
_data+="&id="+encodeURIComponent(vendor);if(name)
_data+="&name="+encodeURIComponent(name);if(value)
_data+="&value="+encodeURIComponent(value);_id=$j.ajax({type:"POST",async:false,url:_url,data:_data,success:function(msg){_id=msg;}}).responseText;return _id;}};var budget=el.budget=AQS.Base.UI.Budget.initialize(el.config.budget_list)
var remaining_budget_el=$j('#remaining-budget',this);var remaining_percent_el=$j('#remaining-percent',this);var total_budget_el=$j('input[name=\'total_budget\']',this);var custom_length=0;for(var a in el.config.budget_data){++custom_length;class_v="class='"+((custom_length%2)?'even':'odd')+"'";_bd=el.config.budget_data[a];$j("#customList tbody").append(el.display.buildItem(class_v,a,_bd.type,_bd.name));$j.data($j("#cb_item_"+a+" .estimate input[name='estimate']").get(0),"estimate",el.config.budget_data[a]);$j("#cb_item_"+a+" .estimate input[name='estimate']",this).attr("value",el.config.budget_data[a].estimate);$j("#cb_item_"+a+" input[name='name']",this).attr("value",el.config.budget_data[a].name);}
total_budget_el.attr("value",el.config.total_budget);budget.add("custom",el.config.budget_data,function(){});el.display.updateBudgetDisplay();total_budget_el.keyup(function(e){if(this.value>1000000||this.value<1){remaining_budget_el.text("N/A");remaining_percent_el.text("N/A");total_budget_el.css({background:'red'});}else if((e.which>=0&&e.which<=31)||(e.which==46)||(e.which>=48&&e.which<=57)||(e.which>=96&&e.which<=110)){total_budget_el.css({background:'white'});el.display.updateBudgetDisplay();el.ajax.updateBudget(this.value);}});total_budget_el.keypress(function(e){if((e.which>=0&&e.which<=31)||(e.which==46)||(e.which>=48&&e.which<=57)||(e.which>=96&&e.which<=110)||(e.which>=37&&e.which<=40)){return true}else{return false;}});$j('#customList',this).each(function(){$j('input[name=\'name\']',this).change(function(){d=$j.data($j(this).parent().parent().children('td.estimate').children('input').get(0),"estimate");el.ajax.updateBudgetItem(d.id,"name",this.value);});$j('input[name=\'estimate\']',this).keyup(function(e){if(this.value>1000000||this.value<0){remaining_budget_el.text("N/A");remaining_percent_el.text("N/A");}else if((e.which>=0&&e.which<=31)||(e.which==46)||(e.which>=48&&e.which<=57)||(e.which>=96&&e.which<=110)){$j.data(this,"estimate").estimate=this.value;el.display.updateBudgetDisplay();d=$j.data(this,"estimate");el.ajax.updateBudgetItem(d.id,"estimate",d.estimate);}});$j('input[name=\'estimate\']',this).keypress(function(e){if((e.which>=0&&e.which<=31)||(e.which==46)||(e.which>=48&&e.which<=57)||(e.which>=37&&e.which<=40)){return true}else{return false;}});$j('.delete img').click(function(){d=$j.data($j(this).parent().parent().children('td.estimate').children('input').get(0),"estimate");el.ajax.removeBudgetItem(d.id,"custom");$j(this).parents('tr').remove();budget.remove("custom",d.row_id,function(){});el.display.updateBudgetDisplay();});});$j('.customAdd',this).click(function(){el.manager.addBudgetItem("custom");return false;});});}}
$j.fn.budgetize=AQS.Base.UI.Budget.build;
AQS.Base.UI.Checklist={};AQS.Base.UI.Checklist={initialize:function(types){console.log(types);this.item_list=new Object();item_list=this.item_list;$j.each(types,function(i,n){item_list[i]=new Base_ItemList(i);});return{item_list:this.item_list,Item:AQS.Base.UI.Checklist.Item,remove:function(type,id,_h){if(!type||!id||!_h)
return false;b=this.item_list[type];b.e_item_state_handler=_h;b.setState(0);return b.remove(id);},addList:function(i){if(!i)
return false;this.item_list[i]=new Base_ItemList(i);return true;},add:function(type,data,_h){if(!data||!_h||!type)
return false;b=this.item_list[type];if(!b)
return false;b.e_item_state_handler=_h;b.setState(1);for(l_x in data)
b.add(l_x,data[l_x]);return true;},get:function(type,id){if(!id||!type)
return false;try{b=this.item_list[type];return b.get(id);}catch(e){return false;}},toJSON:function(type){if(!type)
return false;b=this.item_list[type];if(!b)return false;b.m_list.toJSONString();},globalRemainingTotal:function(){var total=0;for(var a in this.item_list){for(var b in this.item_list[a].m_list){if(this.item_list[a].m_list[b].completed!=true){++total;}}}
return total;},total:function(name){var total=0;for(var b in this.item_list[name].m_list){++total;}
return total;},remainingTotal:function(name){var total=0;console.log(name);for(var b in this.item_list[name].m_list){if(this.item_list[name].m_list[b].completed!=true){++total;}}
return total;},completedTotal:function(name){var total=0;for(var b in this.item_list[name].m_list){if(this.item_list[name].m_list[b].completed==true){++total;}}
return total;},overdueTotal:function(name){var total=0;for(var b in this.item_list[name].m_list){var c=this.item_list[name].m_list[b];var today=new Date();var _s=c.end_date.split('/');var end_date=new Date(_s[2],_s[0]-1,_s[1]);if(c.completed!=true&&c.end_date!=''&&(today.getTime()-end_date.getTime()>0)){++total;}}
return total;}}},build:function(options){return this.each(function(){var el=this;el.config={checklists:options.checklists||{1:"My List"},checklists_data:options.checklists_data||{1:{1:{id:'100',summary:'my job 100',start_date:'11/25/2007',end_date:'11/25/2007',completed:false},2:{id:'101',summary:'my job 101',start_date:'11/25/2007',end_date:'11/25/2007',completed:true},3:{id:'102',summary:'my job 102',start_date:'11/25/2007',end_date:'11/25/2007',completed:false}}}};el.manager={addNewTask:function(checklist_id){console.log("Adding new task: %i",checklist_id);task_id=++el.m_length[checklist_id];console.log("Task ID: %i",task_id);class_v="class=\"vevent ";class_v+=(task_id)%2?'odd':'even';class_v+="\"";task={id:'',summary:'',start_date:'',end_date:'',completed:false};_l={};_l[task_id]=task;el.config.checklists_data[checklist_id][task_id]=task;el.checklist.add(checklist_id,_l,function(){});id=el.ajax.addTask(checklist_id,'');_bd=el.config.checklists_data[checklist_id][task_id];_bd.id=id;$j("#checklist_"+checklist_id+" tbody.open-tasklist",this).append(el.display.buildTask(class_v,checklist_id,task_id,_bd.summary,_bd.start_date,_bd.end_date));$j("#task_"+checklist_id+"_"+task_id+" td.delete").click(el.events.clickRemoveTask);$j("#task_"+checklist_id+"_"+task_id+" td.complete").click(el.events.clickCompleteTask);edit=['summary','location'];for(var e in edit){console.log("Setting Edit Field: %s",e);$j("#task_"+checklist_id+"_"+task_id+" td."+edit[e]).inPlaceEdit({url:AQS.settings.site_url+'/db/parties/update_task',class_name:edit[e],params:'name='+encodeURIComponent(edit[e])+'&id='+encodeURIComponent(_bd.id),update_value:'value',value_required:true,after_default:false,args:{name:edit[e],task:_bd},success:function(html,original_element,args){args.task[args.name]=html;return true;}});}
pickers=['dtstart','dtend'];for(var p in pickers){$j("#task_"+checklist_id+"_"+task_id+" td."+pickers[p]+" input").change(el.events.changeStartDate);$j("#task_"+checklist_id+"_"+task_id+" td."+pickers[p]+" input").change(el.events.changeEndDate);$j("#task_"+checklist_id+"_"+task_id+" td."+pickers[p]+" input").datepicker();}
var ataskrow=$j("#task_"+checklist_id+"_"+task_id)[0];console.log("Task Row Object: %s",ataskrow);$j.data(ataskrow,"task",el.config.checklists_data[checklist_id][task_id]);el.display.updateCheckList(checklist_id);return true;},addNewCheckList:function(title,description,complete){console.log("Initializing checklist... %s",el.config.checklists[a]);checklist_id=el.ajax.addCheckList(title,description,complete);el.config.checklists[checklist_id]=title;el.config.checklists_data[checklist_id]={};el.m_length[checklist_id]=0;el.checklist.addList(checklist_id);el.checklist.add(checklist_id,el.config.checklists_data[checklist_id],function(){});$j("#checklist h3#new_checklist").after(el.display.buildCheckList(checklist_id,title,description));$j('#checklist_'+checklist_id+' > ul').tabs();$j('#checklist_'+checklist_id+' .checklist-name').inPlaceEdit({url:AQS.settings.site_url+'/db/parties/update_checklist',class_name:'title',params:'name=title'+'&id='+encodeURIComponent(checklist_id),update_value:'value',value_required:true,after_default:false,args:{name:'title',checklist:el.config.checklists[checklist_id]},success:function(html,original_element,args){args.checklist=html;return true;}});for(var a in el.config.handlerIndex){var _h=el.config.handlerIndex[a];if(_h.customBind){_h.customBind();}else{$j(_h.target,this).each(function(){$j(this).bind(_h.event,_h.method);});}}
return true;},addChecklistItem:function(type,name,vendor_id,i,_h){if(typeof(_h)!="undefined")
return _h(i);return true;},setCompletedTask:function(checklist_id,task_id,completed){var cl=$j("#checklist_"+checklist_id);var tr=$j("#task_"+checklist_id+"_"+task_id);$j.data(tr.get(0),"task").completed=completed;if(completed){$j("#checklist_"+checklist_id+" span.tab-completed").animate({color:'yellow'},200).animate({color:'white'},250);$j("#checklist_"+checklist_id+" tbody.completed-tasklist").append(tr);}else{$j("#checklist_"+checklist_id+" span.tab-open").animate({color:'yellow'},200).animate({color:'white'},250);$j("#checklist_"+checklist_id+" tbody.open-tasklist").append(tr);}
el.ajax.updateTask($j.data(tr.get(0),"task").id,'completed',completed);el.display.updateCheckList(checklist_id);},removeTask:function(checklist_id,task_id){var cl=$j("#checklist_"+checklist_id);var tr=$j("#task_"+checklist_id+"_"+task_id);var _d=$j.data(tr.get(0),"task")
console.log("Removing Task: %o",tr);el.checklist.remove(checklist_id,task_id,function(){});el.ajax.removeTask(_d.id);tr.remove();el.display.updateCheckList(checklist_id);},removeCheckList:function(checklist_id){el.ajax.removeCheckList(checklist_id);el.display.removeCheckList(checklist_id);},updateTask:function(checklist_id,task_id,name,value){var tr=$j("#task_"+checklist_id+"_"+task_id);el.ajax.updateTask($j.data(tr.get(0),"task").id,name,value);$j.data(tr.get(0),"task")[name]=value;el.display.updateCheckList(checklist_id);}};el.display={updateCheckList:function(checklist_id){console.log("Updating CheckList");blocked=['updateCheckList','buildTask','buildCheckList','removeCheckList','removeCheckListTable'];for(var a in el.display){pass=true;for(var b in blocked){if(a==blocked[b])
pass=false;}
if(pass){_m=el.display[a];_m(checklist_id);}}
var _d=0;$j('#checklist_'+checklist_id+' .open-tasklist tr').each(function(){++_d;(_d%2)?$j(this).addClass('odd').removeClass('even'):$j(this).addClass('even').removeClass('odd');});_d=0;$j('#checklist_'+checklist_id+' .completed-tasklist tr').each(function(){++_d;(_d%2)?$j(this).addClass('odd').removeClass('even'):$j(this).addClass('even').removeClass('odd');});return true;},updateTasks:function(checklist_id){console.log("Updating Tasks");return true;},updateRemaining:function(checklist_id){console.log("Updating Remaining Tasks");var rt=el.checklist.remainingTotal(checklist_id);console.log("Remaining Tasks: %i",rt);$j('#checklist_'+checklist_id+' .remaining-tasks').text(rt);return true;},updateCompleted:function(checklist_id){console.log("Updating Completed Tasks");var rt=el.checklist.completedTotal(checklist_id);console.log("Completed Tasks: %i",rt);$j('#checklist_'+checklist_id+' .completed-tasks').text(rt);return true;},updateTotal:function(checklist_id){console.log("Updating Total Number of Tasks");var rt=el.checklist.total(checklist_id);$j('#checklist_'+checklist_id+' .total-tasks').text(rt);return true;},updateOverdue:function(checklist_id){console.log("Updating OverDue Tasks");var rt=el.checklist.overdueTotal(checklist_id);$j('#checklist_'+checklist_id+' .overdue-tasks').text(rt);return true;},updateTabs:function(checklist_id){console.log("Updating Open Tasks");var rt_a=el.checklist.remainingTotal(checklist_id);var rt_b=el.checklist.completedTotal(checklist_id);$j('#checklist_'+checklist_id+' .tab-open',el).text("Open ("+rt_a+")");$j('#checklist_'+checklist_id+' .tab-completed',el).text("Completed ("+rt_b+")");return true;},removeCheckList:function(checklist_id){return $j('#checklist_'+checklist_id).remove();},buildTask:function(class_v,a,b,summary,start_date,end_date,location){if(!location)location="(Optional)";if(!start_date)start_date="(Optional)";if(!end_date)end_date="(Optional)";str="<tr id=\"task_"+a+"_"+b+"\" "+class_v+" rel=\""+a+"\"><td class=\"complete\" rel=\""+b+"\"><img alt=\"completed\" src=\""+AQS.settings.image_url+"/buttons/accept.png\" /></td><td class=\"summary\">"+summary+"</td><td class=\"dtstart\" rel=\""+b+"\"><input type=\"text\" class=\"dtstart\" size=\"10\" value=\""+start_date+"\" /></td><td class=\"dtend\" rel=\""+b+"\"><input type=\"text\" class=\"dtend\" size=\"10\" value=\""+end_date+"\" /></td><td class=\"location\" >"+location+"</td><td class=\"delete\" rel=\""+b+"\"><img alt=\"delete\" src=\""+AQS.settings.image_url+"/buttons/delete.png\" /></td></tr>";return str;},buildCheckList:function(checklist_id,name,description){if(!name)name="(Not Set)";str="";str+="<div id=\"checklist_"+checklist_id+"\" class=\"checklist\">";str+="<h3 class=\"checklist-title\">CheckList Name: <span class=\"checklist-name inline_edit\">"+name+"</span></h3>";str+="<ul>";str+="<li><a href=\"#fragment-"+checklist_id+"-1\"><span class=\"tab-open\">Open (0)</span></a></li>";str+="<li><a href=\"#fragment-"+checklist_id+"-2\"><span class=\"tab-completed\">Completed (0)</span></a></li>";str+="</ul>";str+="<div id=\"fragment-"+checklist_id+"-1\">";str+=el.display.buildCheckListTable("open-tasklist",['&nbsp;',"Open Task",'Start Date','Due Date','Location','&nbsp;'],[{klass:'remaining-tasks',value:'Remaining '},{klass:'overdue-tasks',value:' | Overdue '},{klass:'total-tasks',value:' | Total '}],checklist_id);str+="</div>";str+="<div id=\"fragment-"+checklist_id+"-2\">";str+=el.display.buildCheckListTable("completed-tasklist",['&nbsp;','Completed Task','Start Date','Completed Date','Location','&nbsp;'],[{klass:'completed-tasks',value:'Tasks Completed'},{klass:'overdue-tasks',value:'Tasks Completed Overdue'},{klass:'total-tasks',value:'Total Number of Tasks'}],checklist_id);str+="</div>";str+="</div>";return str;},buildCheckListTable:function(class_table,col_h,col_f,checklist_id){str="<table class=\"budgetTable\" cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">";str+="<thead>";str+="<tr>";for(var a in col_h){str+="<th>"+col_h[a]+"</th>";}
str+="</tr>";str+="</thead>";str+="<tfoot rel=\""+checklist_id+"\">";str+="<tr><td colspan=\"6\">";str+="<a class=\"add-task\" href=\"#add-task\" rel=\""+checklist_id+"\"><span>+ Add New Task</span></a>";str+="</td></tr>";str+="<tr class=\"tfooter\"><td class=\"remaining-items\" colspan=\"4\">";for(var a in col_f){if(!col_f[a].content)col_f[a].content=0;str+=col_f[a].value+"<span class=\""+col_f[a].klass+"\">0</span>";}
str+="</td>";str+="<td align=\"right\">Delete This CheckList   </td>";str+="<td class=\"delete-checklist\">";str+="<span class=\"delete\"><img src=\""+AQS.settings.image_url+"/buttons/delete.png\" alt=\"Delete CheckList\"/></span></td>";str+="</tr>";str+="</tfoot>";str+="<tbody class=\""+class_table+"\">";str+="</tbody>";str+="</table>";return str;}};el.ajax={addCheckList:function(title,description,complete){var _id=0;_url=AQS.settings.site_url+'/db/parties/add_checklist';_data="";if(title)
_data+="&checklist[title]="+encodeURIComponent(title);if(description)
_data+="&checklist[description]="+encodeURIComponent(description);if(complete)
_data+="&checklist[complete]="+encodeURIComponent(complete);_id=$j.ajax({type:"POST",async:false,url:_url,data:_data,success:function(msg){_id=msg;}}).responseText;return _id;},updateCheckList:function(id,name,value){_url=AQS.settings.site_url+'/db/parties/update_checklist';_data+="id="+encodeURIComponent(id);_data+="&name="+encodeURIComponent(name);_data+="&value="+encodeURIComponent(value);return $j.ajax({type:"POST",url:_url,data:_data,success:function(msg){}});},removeCheckList:function(id){_url=AQS.settings.site_url+'/db/parties/remove_checklist';_data="id="+encodeURIComponent(id);return $j.ajax({type:"POST",url:_url,data:_data,success:function(msg){}});},addTask:function(checklist_id,summary,start_date,end_date,completed){var _id=0;_url=AQS.settings.site_url+'/db/parties/add_task';_data="checklist_id="+encodeURIComponent(checklist_id);if(summary)
_data+="&task[summary]="+encodeURIComponent(summary);if(checklist_id)
_data+="&task[checklist_id]="+encodeURIComponent(checklist_id);if(start_date)
_data+="&task[start_date]="+encodeURIComponent(start_date);if(end_date)
_data+="&task[end_date]="+encodeURIComponent(end_date);if(completed)
_data+="&task[completed]="+encodeURIComponent(completed);_id=$j.ajax({type:"POST",async:false,url:_url,data:_data,success:function(msg){_id=msg;}}).responseText;return _id;},removeTask:function(id){_url=AQS.settings.site_url+'/db/parties/remove_task';_data="id="+encodeURIComponent(id);return $j.ajax({type:"POST",url:_url,data:_data,success:function(msg){}});},updateTask:function(id,name,value){_url=AQS.settings.site_url+'/db/parties/update_task';_data="id="+encodeURIComponent(id)+"&name="+encodeURIComponent(name)+"&value="+encodeURIComponent(value);return $j.ajax({type:"POST",url:_url,data:_data,success:function(msg){}});}};el.events={clickAddTask:function(){checklist_id=$j(this).attr("rel");console.log("%o",$j("#checklist_"+checklist_id));el.manager.addNewTask(checklist_id);return true;},clickRemoveTask:function(){console.log("ClickRemoveTask");checklist_id=$j(this).parent().attr("rel");task_id=$j(this).attr("rel");el.manager.removeTask(checklist_id,task_id);return true;},clickCompleteTask:function(){console.log("ClickCompleteTask");checklist_id=$j(this).parent().attr("rel");task_id=$j(this).attr("rel");var rt=$j(this).parent();switch($j(this).parent().parent().attr("class")){case"open-tasklist":el.manager.setCompletedTask(checklist_id,task_id,1);return true;case"completed-tasklist":el.manager.setCompletedTask(checklist_id,task_id,0);return true;}},changeStartDate:function(){console.log("Change Start Date");checklist_id=$j(this).parent().parent().attr("rel");task_id=$j(this).parent().attr("rel");var rt=$j(this).parent().parent();el.manager.updateTask(checklist_id,task_id,'start_date',this.value);},changeEndDate:function(){console.log("Change End Date");checklist_id=$j(this).parent().parent().attr("rel");task_id=$j(this).parent().attr("rel");var rt=$j(this).parent().parent();$j('#checklist_'+checklist_id+' .overdue-tasks').animate({background:'yellow'},200).animate({background:'white'},250);el.manager.updateTask(checklist_id,task_id,'end_date',this.value);},clickRemoveCheckList:function(){console.log("Remove CheckList");checklist_id=$j(this).parent().parent().parent().parent().attr("rel");el.manager.removeCheckList(checklist_id);}};el.config.handlerIndex={clickAddTask:{event:"click",target:"a.add-task",method:el.events.clickAddTask},changeStartDate:{event:"change",target:"td.dtstart input",method:el.events.changeStartDate},changeEndDate:{event:"change",target:"td.dtend input",method:el.events.changeEndDate},clickRemoveTask:{customBind:function(){$j('td.delete').each(function(){$j(this).click(el.events.clickRemoveTask);});}},clickCompleteTask:{customBind:function(){$j('td.complete').each(function(){$j(this).click(el.events.clickCompleteTask);});}},clickRemoveCheckList:{event:"click",target:"td.delete-checklist img",method:el.events.clickRemoveCheckList}};var checklist=el.checklist=AQS.Base.UI.Checklist.initialize(el.config.checklists);var remaining_tasks_el=$j('#remaining-tasks',this);var completed_tasks_el=$j('#completed-tasks',this);var overdue_tasks_el=$j('#overdue-tasks',this);var total_tasks_el=$j('#total-tasks',this);var remaining_percent_el=$j('#remaining-percent',this);var m_length=el.m_length=[];for(var a in el.config.checklists){console.log("Initializing checklist... %s",el.config.checklists[a]);console.log("Initializing checklist data... %o",el.config.checklists_data[a]);el.checklist.add(a,el.config.checklists_data[a],function(){});$j('#checklist_'+a+' > ul').tabs();$j('#checklist_'+a+' .checklist-name').inPlaceEdit({url:AQS.settings.site_url+'/db/parties/update_checklist',class_name:'title',params:'name=title'+'&id='+encodeURIComponent(a),update_value:'value',value_required:true,after_default:false,args:{name:'title',checklist:el.config.checklists[a]},success:function(html,original_element,args){args.checklist=html;return true;}});for(var b in el.config.checklists_data[a]){if(!m_length[a])m_length[a]=0;++m_length[a];_bd=el.config.checklists_data[a][b];console.log("Data: %o",_bd);console.log("Length Array: "+m_length[a]);class_v="class='vevent "+((m_length[a]%2)?'odd':'even')+"'";console.log("Find this: %o",m_length[a]);console.log("_BD: %o",_bd);var t;if(_bd.completed==false)
t="open";else
t="completed";task_row=el.display.buildTask(class_v,a,b,_bd.summary,_bd.start_date,_bd.end_date);console.log("Task Row: %s",(task_row));$j("#checklist_"+a+" tbody."+t+"-tasklist",this).append(task_row);console.log("A:%i, B:%i",a,b);$j.data($j("#task_"+a+"_"+b).get(0),"task",el.config.checklists_data[a][b]);console.log("yo");edit=['summary','location'];for(var e in edit){console.log("Setting Edit Field: %s",e);$j("#task_"+a+"_"+b+" td."+edit[e]).inPlaceEdit({url:AQS.settings.site_url+'/db/parties/update_task',class_name:edit[e],params:'name='+encodeURIComponent(edit[e])+'&id='+encodeURIComponent(el.config.checklists_data[a][b].id),update_value:'value',value_required:true,after_default:false,args:{name:edit[e],task:el.config.checklists_data[a][b]},success:function(html,original_element,args){args.task[args.name]=html;return true;}});}
pickers=['dtstart','dtend'];for(var p in pickers){$j("#task_"+a+"_"+b+" td."+pickers[p]+" input").datepicker();}}
el.display.updateCheckList(a);}
for(var a in el.config.handlerIndex){var _h=el.config.handlerIndex[a];if(_h.customBind){_h.customBind();}else{$j(_h.target,this).each(function(){$j(this).bind(_h.event,_h.method);});}}
$j('#new_checklist').click(function(){$j('#hiddenFlash').text('Your New CheckList Added Successfully!');$j('#hiddenFlash').slideDown('normal',function(){$j('#hiddenFlash').fadeOut(10000);});el.manager.addNewCheckList('(Not Set)','',false);});});}}
$j.fn.checkify=AQS.Base.UI.Checklist.build;
AQS.Base.UI.Spotlight={};AQS.Base.UI.Spotlight={build:function(options)
{return this.each(function()
{if(!options.headerSelector||!options.panelSelector||!options.searchSelector)
return;var el=this;el.spotlightCfg={panelHeight:options.panelHeight||300,spotlightSelector:options.spotlightSelector,spotlightWrapperSelector:options.spotlightWrapperSelector,searchSelector:options.searchSelector,headerSelector:options.headerSelector,panelSelector:options.panelSelector,activeClass:options.activeClass||'fakeSpotlightClass',hoverClass:options.hoverClass||'fakeSpotlightClass',onShow:options.onShow&&typeof options.onShow=='function'?options.onShow:false,onHide:options.onShow&&typeof options.onHide=='function'?options.onHide:false,onClick:options.onClick&&typeof options.onClick=='function'?options.onClick:false,onSearch:options.onSearch&&typeof options.onSearch=='function'?options.onSearch:false,headers:jQuery(options.headerSelector,this),search:jQuery(options.searchSelector,this),panels:jQuery(options.panelSelector,this),searchTerm:jQuery(options.searchSelector+' input[@type=text]',this),spotlight:jQuery(options.spotlightSelector,this)||'#spotlight',spotlightWrapper:jQuery(options.spotlightWrapperSelector,this)||'#spotlight',speed:options.speed||400,currentPanel:options.currentPanel||0};el.spotlightCfg.search.submit(function(){var pHeight=el.spotlightCfg.panelHeight+'px';el.spotlightCfg.currentPanel=0;if(el.spotlightCfg.spotlight.children().length>0){el.spotlightCfg.spotlight.fadeOut('slow').children('dd, dt').remove().end();}else{el.spotlightCfg.spotlight.children('dd').css({overflow:'hidden',height:el.spotlightCfg.panelHeight}).end().slideUp(1150,"easeout")}
el.spotlightCfg.spotlight.append(el.spotlightCfg.onSearch(el.spotlightCfg.searchTerm[0].value,$j(el.spotlightCfg.panels)))
el.spotlightCfg.headers=jQuery(options.headerSelector,el.spotlightCfg.spotlight);el.spotlightCfg.panels=jQuery(options.panelSelector,el.spotlightCfg.spotlight);el.spotlightCfg.spotlight.children('dd').css({overflow:'hidden',height:el.spotlightCfg.panelHeight}).end().slideDown(1000,function(){el.spotlightCfg.spotlight.children('dd').css({overflow:'auto',height:el.spotlightCfg.panelHeight});}).end();AQS.Base.UI.Spotlight.accordionize(el);return false;});});}};$j.fn.Spotlight=AQS.Base.UI.Spotlight.build;AQS.Base.UI.Spotlight.accordionize=function(el){el.spotlightCfg.panels.hide().css('height','1px').eq(0).css({height:el.spotlightCfg.panelHeight+'px',display:'block'}).end();el.spotlightCfg.headers.each(function(nr)
{this.spotlightPos=nr;}).hover(function()
{jQuery(this).addClass(el.spotlightCfg.hoverClass);},function()
{jQuery(this).removeClass(el.spotlightCfg.hoverClass);}).bind('click',function(e)
{if(el.spotlightCfg.currentPanel==this.spotlightPos)
return;el.spotlightCfg.headers.eq(el.spotlightCfg.currentPanel).removeClass(el.spotlightCfg.activeClass).end().eq(this.spotlightPos).addClass(el.spotlightCfg.activeClass).end();el.spotlightCfg.panels.eq(el.spotlightCfg.currentPanel).animate({height:0},el.spotlightCfg.speed,function()
{this.style.display='none';if(el.spotlightCfg.onHide){el.spotlightCfg.onHide.apply(el,[this]);}}).end().eq(this.spotlightPos).show().animate({height:el.spotlightCfg.panelHeight},el.spotlightCfg.speed,function()
{this.style.display='block';if(el.spotlightCfg.onShow){el.spotlightCfg.onShow.apply(el,[this]);}}).end();if(el.spotlightCfg.onClick){el.spotlightCfg.onClick.apply(el,[this,el.spotlightCfg.panels.get(this.spotlightPos),el.spotlightCfg.headers.get(el.spotlightCfg.currentPanel),el.spotlightCfg.panels.get(el.spotlightCfg.currentPanel)]);}
el.spotlightCfg.currentPanel=this.spotlightPos;}).eq(0).addClass(el.spotlightCfg.activeClass).end();el.spotlightCfg.spotlight.css('height',el.spotlightCfg.spotlight.css('height')).css('overflow','hidden');}
AQS.Base.UI.Effects={};AQS.Base.UI.Effects={doneLoading:function(){$j('.wait').hide();$j('.loader').show();},toggleLogin:function(){if(this.m_lb_state=='search'){$j('#loginbx').slideToggle('slow');this.m_lb_state='login';}else{$j('#loginbx').slideUp('fast');this.m_lb_state='search';}},toggleId:function(id){if(!id)return;$j('#'+id).slideToggle('800');},showId:function(id){if(!id)return;$j('#'+id).show('normal');},toggleUIC:function(){if(this.m_uic_state=='closed'){$j('#uic').animate({width:350},'fast');this.m_uic_state='open';}else{$j('#uic').animate({width:40},'fast');this.m_uic_state='closed';}},slideOpenUIC:function(){if(this.m_uic_state=='closed'){$j('#uic').animate({width:350},'fast');this.m_uic_state='open';}},slideCloseUIC:function(){if(this.m_uic_state=='open'){$j('#uic').animate({width:40},'fast');this.m_uic_state='close';}},toggleOperator:function(operator){$j(operator).fadeOut('slow',function(){$j(this).toggleClass('on').fadeIn('fast');});}};AQS.Base.UI.Effects.m_lb_state='search';AQS.Base.UI.Effects.m_uic_state='closed';$j.fn.toggleOperator=AQS.Base.UI.Effects.toggleOperator;
AQS.Base.Ajax={busyNotifier:function(append){var html="<img src=\"http://gfx.bestpartyever.com/gfx/ajax-loader.gif\" border=0/>";if(append){$j(this).append(html);}else{$j(this).html(html);}}};$j.fn.getBusy=AQS.Base.Ajax.busyNotifier;
AQS.Base.Ajax.Basket={};AQS.Base.Ajax.Basket={add:function(basket_item_id,l_type){$j.post('/basket/add/'+l_type+'/'+basket_item_id,{},function(result){$j('#checklist_items').html(result);});},remove:function(basket_item_id,l_type){$j.post('/basket/remove/'+l_type+'/'+basket_item_id,{id:basket_item_id},function(result){});},get:function(l_type){$j.get('/basket/'+l_type,{},function(result){$j('#checklist_items').html(result);AQS.Base.UI.Effects.slideOpenUIC();});},toggle:function(basket_item_id,basket_item_name,l_type,label,opt_label){b=AQS.Base.Ajax.Basket.m_basket;var _t=(typeof(AQS.Base.Ajax.Basket.m_basket.get(l_type,basket_item_id)));if(typeof(AQS.Base.Ajax.Basket.m_basket.get(l_type,basket_item_id))=="object"){return AQS.Base.Ajax.Basket.m_basket.remove(l_type,basket_item_id,function(m){var ctr=$j("#ui_"+l_type+"_btn span")
ctr.html(parseInt(ctr.text())-1||"0");if(ctr.text()=="0"||ctr.text()==""){ctr.removeClass("count");ctr.addClass("hide");}
if(typeof(opt_label)=="object"){if(opt_label.parent().children().length=="1"){opt_label.parent().parent().children('h3.catHeader').remove();opt_label.remove();}else{opt_label.remove();}}
$j(label).toggleOperator(label);AQS.Base.Ajax.Basket.remove(basket_item_id,l_type);});}
var item={};item[basket_item_id]={value:basket_item_name};AQS.Base.Ajax.Basket.m_basket.add(l_type,item,function(m){var ctr=$j("#ui_"+l_type+"_btn span")
ctr.html(parseInt(ctr.text())+1);if(ctr.text()=="1")ctr.addClass("count");AQS.Base.UI.Effects.slideOpenUIC();$j(label).toggleOperator(label);AQS.Base.Ajax.Basket.add(basket_item_id,l_type);});}};AQS.Base.Ajax.Basket.m_basket_list={1:"vendor",2:"idea",3:"party",4:"friend"};AQS.Base.Ajax.Basket.m_basket=new AQS.Base.UI.Basket(AQS.Base.Ajax.Basket.m_basket_list);
AQS.Base.Ajax.Search={getMoreResults:function(termStr,typeName,categoryID,numResults){$j.post('/search/more',{term:termStr,type:typeName,category_id:categoryID,num_results:numResults,ajax:1},function(result){$j('#result-group-'+categoryID).html(result);});}};
AQS.Base.Ajax.Register={getIndustries:function(parent_id){var _r=$j.ajax({type:'POST',async:false,dataType:'json',url:'/industry/'+parent_id,data:{industry:parent_id,ajax:1}}).responseText;return eval(_r);}};
(function($j){$j.ui=$j.ui||{};$j.extend($j.ui,{plugin:{add:function(w,c,o,p){var a=$j.ui[w].prototype;if(!a.plugins[c])a.plugins[c]=[];a.plugins[c].push([o,p]);},call:function(instance,name,arguments){var c=instance.plugins[name];if(!c)return;var o=instance.interaction?instance.interaction.options:instance.options;var e=instance.interaction?instance.interaction.element:instance.element;for(var i=0;i<c.length;i++){if(o[c[i][0]])c[i][1].apply(e,arguments);}}}});$j.fn.mouseInteractionDestroy=function(){this.each(function(){if($j.data(this,"ui-mouse"))$j.data(this,"ui-mouse").destroy();});}
$j.ui.mouseInteraction=function(el,o){if(!o)var o={};this.element=el;$j.data(this.element,"ui-mouse",this);this.options={};$j.extend(this.options,o);$j.extend(this.options,{handle:o.handle?($j(o.handle,el)[0]?$j(o.handle,el):$j(el)):$j(el),helper:o.helper||'original',preventionDistance:o.preventionDistance||0,dragPrevention:o.dragPrevention?o.dragPrevention.toLowerCase().split(','):['input','textarea','button','select','option'],cursorAt:{top:((o.cursorAt&&o.cursorAt.top)?o.cursorAt.top:0),left:((o.cursorAt&&o.cursorAt.left)?o.cursorAt.left:0),bottom:((o.cursorAt&&o.cursorAt.bottom)?o.cursorAt.bottom:0),right:((o.cursorAt&&o.cursorAt.right)?o.cursorAt.right:0)},cursorAtIgnore:(!o.cursorAt)?true:false,appendTo:o.appendTo||'parent'})
o=this.options;if(!this.options.nonDestructive&&(o.helper=='clone'||o.helper=='original')){o.margins={top:parseInt($j(el).css('marginTop'))||0,left:parseInt($j(el).css('marginLeft'))||0,bottom:parseInt($j(el).css('marginBottom'))||0,right:parseInt($j(el).css('marginRight'))||0};if(o.cursorAt.top!=0)o.cursorAt.top=o.margins.top;if(o.cursorAt.left!=0)o.cursorAt.left+=o.margins.left;if(o.cursorAt.bottom!=0)o.cursorAt.bottom+=o.margins.bottom;if(o.cursorAt.right!=0)o.cursorAt.right+=o.margins.right;if(o.helper=='original')
o.wasPositioned=$j(el).css('position');}else{o.margins={top:0,left:0,right:0,bottom:0};}
var self=this;this.mousedownfunc=function(e){return self.click.apply(self,[e]);}
o.handle.bind('mousedown',this.mousedownfunc);if($j.browser.msie)$j(this.element).attr('unselectable','on');}
$j.extend($j.ui.mouseInteraction.prototype,{plugins:{},currentTarget:null,lastTarget:null,timer:null,slowMode:false,init:false,destroy:function(){this.options.handle.unbind('mousedown',this.mousedownfunc);},trigger:function(e){return this.click.apply(this,arguments);},click:function(e){var o=this.options;window.focus();if(e.which!=1)return true;var targetName=(e.target)?e.target.nodeName.toLowerCase():e.srcElement.nodeName.toLowerCase();for(var i=0;i<o.dragPrevention.length;i++){if(targetName==o.dragPrevention[i])return true;}
if(o.startCondition&&!o.startCondition.apply(this,[e]))return true;var self=this;this.mouseup=function(e){return self.stop.apply(self,[e]);}
this.mousemove=function(e){return self.drag.apply(self,[e]);}
var initFunc=function(){$j(document).bind('mouseup',self.mouseup);$j(document).bind('mousemove',self.mousemove);self.opos=[e.pageX,e.pageY];}
if(o.preventionTimeout){if(this.timer)clearInterval(this.timer);this.timer=setTimeout(function(){initFunc();},o.preventionTimeout);return false;}
initFunc();return false;},start:function(e){var o=this.options;var a=this.element;o.co=$j(a).offset();this.helper=typeof o.helper=='function'?$j(o.helper.apply(a,[e,this]))[0]:(o.helper=='clone'?$j(a).clone()[0]:a);if(o.appendTo=='parent'){var cp=a.parentNode;while(cp){if(cp.style&&($j(cp).css('position')=='relative'||$j(cp).css('position')=='absolute')){o.pp=cp;o.po=$j(cp).offset();o.ppOverflow=!!($j(o.pp).css('overflow')=='auto'||$j(o.pp).css('overflow')=='scroll');break;}
cp=cp.parentNode?cp.parentNode:null;};if(!o.pp)o.po={top:0,left:0};}
this.pos=[this.opos[0],this.opos[1]];this.rpos=[this.pos[0],this.pos[1]];if(o.cursorAtIgnore){o.cursorAt.left=this.pos[0]-o.co.left+o.margins.left;o.cursorAt.top=this.pos[1]-o.co.top+o.margins.top;}
if(o.pp){this.pos[0]-=o.po.left;this.pos[1]-=o.po.top;}
this.slowMode=(o.cursorAt&&(o.cursorAt.top-o.margins.top>0||o.cursorAt.bottom-o.margins.bottom>0)&&(o.cursorAt.left-o.margins.left>0||o.cursorAt.right-o.margins.right>0))?true:false;if(!o.nonDestructive)$j(this.helper).css('position','absolute');if(o.helper!='original')$j(this.helper).appendTo((o.appendTo=='parent'?a.parentNode:o.appendTo)).show();if(o.cursorAt.right&&!o.cursorAt.left)o.cursorAt.left=this.helper.offsetWidth+o.margins.right+o.margins.left-o.cursorAt.right;if(o.cursorAt.bottom&&!o.cursorAt.top)o.cursorAt.top=this.helper.offsetHeight+o.margins.top+o.margins.bottom-o.cursorAt.bottom;this.init=true;if(o._start)o._start.apply(a,[this.helper,this.pos,o.cursorAt,this,e]);this.helperSize={width:outerWidth(this.helper),height:outerHeight(this.helper)};return false;},stop:function(e){var o=this.options;var a=this.element;var self=this;$j(document).unbind('mouseup',self.mouseup);$j(document).unbind('mousemove',self.mousemove);if(this.init==false)return this.opos=this.pos=null;if(o._beforeStop)o._beforeStop.apply(a,[this.helper,this.pos,o.cursorAt,this,e]);if(this.helper!=a&&!o.beQuietAtEnd){$j(this.helper).remove();this.helper=null;}
if(!o.beQuietAtEnd){if(o._stop)o._stop.apply(a,[this.helper,this.pos,o.cursorAt,this,e]);}
this.init=false;this.opos=this.pos=null;return false;},drag:function(e){if(!this.opos||($j.browser.msie&&!e.button))return this.stop.apply(this,[e]);var o=this.options;this.pos=[e.pageX,e.pageY];if(this.rpos&&this.rpos[0]==this.pos[0]&&this.rpos[1]==this.pos[1])return false;this.rpos=[this.pos[0],this.pos[1]];if(o.pp){this.pos[0]-=o.po.left;this.pos[1]-=o.po.top;}
if((Math.abs(this.rpos[0]-this.opos[0])>o.preventionDistance||Math.abs(this.rpos[1]-this.opos[1])>o.preventionDistance)&&this.init==false)
this.start.apply(this,[e]);else{if(this.init==false)return false;}
if(o._drag)o._drag.apply(this.element,[this.helper,this.pos,o.cursorAt,this,e]);return false;}});var num=function(el,prop){return parseInt($j.css(el.jquery?el[0]:el,prop))||0;};function outerWidth(el){var $jel=$j(el),ow=$jel.width();for(var i=0,props=['borderLeftWidth','paddingLeft','paddingRight','borderRightWidth'];i<props.length;i++)
ow+=num($jel,props[i]);return ow;}
function outerHeight(el){var $jel=$j(el),oh=$jel.width();for(var i=0,props=['borderTopWidth','paddingTop','paddingBottom','borderBottomWidth'];i<props.length;i++)
oh+=num($jel,props[i]);return oh;}})(jQuery);(function($j){$j.extend($j.expr[':'],{draggable:"(' '+a.className+' ').indexOf(' ui-draggable ')"});var methods="destroy,enable,disable".split(",");for(var i=0;i<methods.length;i++){var cur=methods[i],f;eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-draggable")) jQuery.data(this, "ui-draggable")["'+cur+'"](a); }); }');$j.fn["draggable"+cur.substr(0,1).toUpperCase()+cur.substr(1)]=f;};$j.fn.draggableInstance=function(){if($j(this[0]).is(".ui-draggable"))return $j.data(this[0],"ui-draggable");return false;};$j.fn.draggable=function(o){return this.each(function(){if(!$j(this).is(".ui-draggable"))new $j.ui.draggable(this,o);});}
$j.ui.ddmanager={current:null,droppables:[],prepareOffsets:function(t,e){var dropTop=$j.ui.ddmanager.dropTop=[];var dropLeft=$j.ui.ddmanager.dropLeft;var m=$j.ui.ddmanager.droppables;for(var i=0;i<m.length;i++){if(m[i].item.disabled)continue;m[i].offset=$j(m[i].item.element).offset();if(t&&m[i].item.options.accept(t.element))
m[i].item.activate.call(m[i].item,e);}},fire:function(oDrag,e){var oDrops=$j.ui.ddmanager.droppables;var oOvers=$j.grep(oDrops,function(oDrop){if(!oDrop.item.disabled&&$j.ui.intersect(oDrag,oDrop,oDrop.item.options.tolerance))
oDrop.item.drop.call(oDrop.item,e);});$j.each(oDrops,function(i,oDrop){if(!oDrop.item.disabled&&oDrop.item.options.accept(oDrag.element)){oDrop.out=1;oDrop.over=0;oDrop.item.deactivate.call(oDrop.item,e);}});},update:function(oDrag,e){if(oDrag.options.refreshPositions)$j.ui.ddmanager.prepareOffsets();var oDrops=$j.ui.ddmanager.droppables;var oOvers=$j.grep(oDrops,function(oDrop){if(oDrop.item.disabled)return false;var isOver=$j.ui.intersect(oDrag,oDrop,oDrop.item.options.tolerance)
if(!isOver&&oDrop.over==1){oDrop.out=1;oDrop.over=0;oDrop.item.out.call(oDrop.item,e);}
return isOver;});$j.each(oOvers,function(i,oOver){if(oOver.over==0){oOver.out=0;oOver.over=1;oOver.item.over.call(oOver.item,e);}});}};$j.ui.draggable=function(el,o){var options={};$j.extend(options,o);var self=this;$j.extend(options,{_start:function(h,p,c,t,e){self.start.apply(t,[self,e]);},_beforeStop:function(h,p,c,t,e){self.stop.apply(t,[self,e]);},_drag:function(h,p,c,t,e){self.drag.apply(t,[self,e]);},startCondition:function(e){return!(e.target.className.indexOf("ui-resizable-handle")!=-1||self.disabled);}});$j.data(el,"ui-draggable",this);if(options.ghosting==true)options.helper='clone';$j(el).addClass("ui-draggable");this.interaction=new $j.ui.mouseInteraction(el,options);}
$j.extend($j.ui.draggable.prototype,{plugins:{},currentTarget:null,lastTarget:null,destroy:function(){$j(this.interaction.element).removeClass("ui-draggable").removeClass("ui-draggable-disabled");this.interaction.destroy();},enable:function(){$j(this.interaction.element).removeClass("ui-draggable-disabled");this.disabled=false;},disable:function(){$j(this.interaction.element).addClass("ui-draggable-disabled");this.disabled=true;},prepareCallbackObj:function(self){return{helper:self.helper,position:{left:self.pos[0],top:self.pos[1]},offset:self.options.cursorAt,draggable:self,options:self.options}},start:function(that,e){var o=this.options;$j.ui.ddmanager.current=this;$j.ui.plugin.call(that,'start',[e,that.prepareCallbackObj(this)]);$j(this.element).triggerHandler("dragstart",[e,that.prepareCallbackObj(this)],o.start);if(this.slowMode&&$j.ui.droppable&&!o.dropBehaviour)
$j.ui.ddmanager.prepareOffsets(this,e);return false;},stop:function(that,e){var o=this.options;$j.ui.plugin.call(that,'stop',[e,that.prepareCallbackObj(this)]);$j(this.element).triggerHandler("dragstop",[e,that.prepareCallbackObj(this)],o.stop);if(this.slowMode&&$j.ui.droppable&&!o.dropBehaviour)
$j.ui.ddmanager.fire(this,e);$j.ui.ddmanager.current=null;$j.ui.ddmanager.last=this;return false;},drag:function(that,e){var o=this.options;$j.ui.ddmanager.update(this,e);this.pos=[this.pos[0]-o.cursorAt.left,this.pos[1]-o.cursorAt.top];$j.ui.plugin.call(that,'drag',[e,that.prepareCallbackObj(this)]);var nv=$j(this.element).triggerHandler("drag",[e,that.prepareCallbackObj(this)],o.drag);var nl=(nv&&nv.left)?nv.left:this.pos[0];var nt=(nv&&nv.top)?nv.top:this.pos[1];$j(this.helper).css('left',nl+'px').css('top',nt+'px');return false;}});})(jQuery);(function($j){$j.ui.plugin.add("draggable","stop","effect",function(e,ui){var t=ui.helper;if(ui.options.effect[1]){if(t!=this){ui.options.beQuietAtEnd=true;switch(ui.options.effect[1]){case'fade':$j(t).fadeOut(300,function(){$j(this).remove();});break;default:$j(t).remove();break;}}}});$j.ui.plugin.add("draggable","start","effect",function(e,ui){if(ui.options.effect[0]){switch(ui.options.effect[0]){case'fade':$j(ui.helper).hide().fadeIn(300);break;}}});$j.ui.plugin.add("draggable","start","cursor",function(e,ui){var t=$j('body');if(t.css("cursor"))ui.options.ocursor=t.css("cursor");t.css("cursor",ui.options.cursor);});$j.ui.plugin.add("draggable","stop","cursor",function(e,ui){if(ui.options.ocursor)$j('body').css("cursor",ui.options.ocursor);});$j.ui.plugin.add("draggable","start","zIndex",function(e,ui){var t=$j(ui.helper);if(t.css("zIndex"))ui.options.ozIndex=t.css("zIndex");t.css('zIndex',ui.options.zIndex);});$j.ui.plugin.add("draggable","stop","zIndex",function(e,ui){if(ui.options.ozIndex)$j(ui.helper).css('zIndex',ui.options.ozIndex);});$j.ui.plugin.add("draggable","start","opacity",function(e,ui){var t=$j(ui.helper);if(t.css("opacity"))ui.options.oopacity=t.css("opacity");t.css('opacity',ui.options.opacity);});$j.ui.plugin.add("draggable","stop","opacity",function(e,ui){if(ui.options.oopacity)$j(ui.helper).css('opacity',ui.options.oopacity);});$j.ui.plugin.add("draggable","stop","revert",function(e,ui){var o=ui.options;var rpos={left:0,top:0};o.beQuietAtEnd=true;if(ui.helper!=this){rpos=$j(ui.draggable.sorthelper||this).offset({border:false});var nl=rpos.left-o.po.left-o.margins.left;var nt=rpos.top-o.po.top-o.margins.top;}else{var nl=o.co.left-(o.po?o.po.left:0);var nt=o.co.top-(o.po?o.po.top:0);}
var self=ui.draggable;$j(ui.helper).animate({left:nl,top:nt},500,function(){if(o.wasPositioned)$j(self.element).css('position',o.wasPositioned);if(o.stop)o.stop.apply(self.element,[self.helper,self.pos,[o.co.left-o.po.left,o.co.top-o.po.top],self]);if(self.helper!=self.element)window.setTimeout(function(){$j(self.helper).remove();},0);});});$j.ui.plugin.add("draggable","start","iframeFix",function(e,ui){var o=ui.options;if(!ui.draggable.slowMode){if(o.iframeFix.constructor==Array){for(var i=0;i<o.iframeFix.length;i++){var co=$j(o.iframeFix[i]).offset({border:false});$j("<div class='DragDropIframeFix' style='background: #fff;'></div>").css("width",$j(o.iframeFix[i])[0].offsetWidth+"px").css("height",$j(o.iframeFix[i])[0].offsetHeight+"px").css("position","absolute").css("opacity","0.001").css("z-index","1000").css("top",co.top+"px").css("left",co.left+"px").appendTo("body");}}else{$j("iframe").each(function(){var co=$j(this).offset({border:false});$j("<div class='DragDropIframeFix' style='background: #fff;'></div>").css("width",this.offsetWidth+"px").css("height",this.offsetHeight+"px").css("position","absolute").css("opacity","0.001").css("z-index","1000").css("top",co.top+"px").css("left",co.left+"px").appendTo("body");});}}});$j.ui.plugin.add("draggable","stop","iframeFix",function(e,ui){if(ui.options.iframeFix)$j("div.DragDropIframeFix").each(function(){this.parentNode.removeChild(this);});});$j.ui.plugin.add("draggable","start","containment",function(e,ui){var o=ui.options;if(!o.cursorAtIgnore||o.containment.left!=undefined||o.containment.constructor==Array)return;if(o.containment=='parent')o.containment=this.parentNode;if(o.containment=='document'){o.containment=[0-o.margins.left,0-o.margins.top,$j(document).width()-o.margins.right,($j(document).height()||document.body.parentNode.scrollHeight)-o.margins.bottom];}else{var ce=$j(o.containment)[0];var co=$j(o.containment).offset({border:false});o.containment=[co.left-o.margins.left,co.top-o.margins.top,co.left+(ce.offsetWidth||ce.scrollWidth)-o.margins.right,co.top+(ce.offsetHeight||ce.scrollHeight)-o.margins.bottom];}});$j.ui.plugin.add("draggable","drag","containment",function(e,ui){var o=ui.options;if(!o.cursorAtIgnore)return;var h=$j(ui.helper);var c=o.containment;if(c.constructor==Array){if((ui.draggable.pos[0]<c[0]-o.po.left))ui.draggable.pos[0]=c[0]-o.po.left;if((ui.draggable.pos[1]<c[1]-o.po.top))ui.draggable.pos[1]=c[1]-o.po.top;if(ui.draggable.pos[0]+h[0].offsetWidth>c[2]-o.po.left)ui.draggable.pos[0]=c[2]-o.po.left-h[0].offsetWidth;if(ui.draggable.pos[1]+h[0].offsetHeight>c[3]-o.po.top)ui.draggable.pos[1]=c[3]-o.po.top-h[0].offsetHeight;}else{if(c.left&&(ui.draggable.pos[0]<c.left))ui.draggable.pos[0]=c.left;if(c.top&&(ui.draggable.pos[1]<c.top))ui.draggable.pos[1]=c.top;var p=$j(o.pp);if(c.right&&ui.draggable.pos[0]+h[0].offsetWidth>p[0].offsetWidth-c.right)ui.draggable.pos[0]=(p[0].offsetWidth-c.right)-h[0].offsetWidth;if(c.bottom&&ui.draggable.pos[1]+h[0].offsetHeight>p[0].offsetHeight-c.bottom)ui.draggable.pos[1]=(p[0].offsetHeight-c.bottom)-h[0].offsetHeight;}});$j.ui.plugin.add("draggable","drag","grid",function(e,ui){var o=ui.options;if(!o.cursorAtIgnore)return;ui.draggable.pos[0]=o.co.left+o.margins.left-o.po.left+Math.round((ui.draggable.pos[0]-o.co.left-o.margins.left+o.po.left)/o.grid[0])*o.grid[0];ui.draggable.pos[1]=o.co.top+o.margins.top-o.po.top+Math.round((ui.draggable.pos[1]-o.co.top-o.margins.top+o.po.top)/o.grid[1])*o.grid[1];});$j.ui.plugin.add("draggable","drag","axis",function(e,ui){var o=ui.options;if(!o.cursorAtIgnore)return;if(o.constraint)o.axis=o.constraint;o.axis?(o.axis=='x'?ui.draggable.pos[1]=o.co.top-o.margins.top-o.po.top:ui.draggable.pos[0]=o.co.left-o.margins.left-o.po.left):null;});$j.ui.plugin.add("draggable","drag","scroll",function(e,ui){var o=ui.options;o.scrollSensitivity=o.scrollSensitivity||20;o.scrollSpeed=o.scrollSpeed||20;if(o.pp&&o.ppOverflow){}else{if((ui.draggable.rpos[1]-$j(window).height())-$j(document).scrollTop()>-o.scrollSensitivity)window.scrollBy(0,o.scrollSpeed);if(ui.draggable.rpos[1]-$j(document).scrollTop()<o.scrollSensitivity)window.scrollBy(0,-o.scrollSpeed);if((ui.draggable.rpos[0]-$j(window).width())-$j(document).scrollLeft()>-o.scrollSensitivity)window.scrollBy(o.scrollSpeed,0);if(ui.draggable.rpos[0]-$j(document).scrollLeft()<o.scrollSensitivity)window.scrollBy(-o.scrollSpeed,0);}});$j.ui.plugin.add("draggable","drag","wrapHelper",function(e,ui){var o=ui.options;if(o.cursorAtIgnore)return;var t=ui.helper;if(!o.pp||!o.ppOverflow){var wx=$j(window).width()-($j.browser.mozilla?20:0);var sx=$j(document).scrollLeft();var wy=$j(window).height();var sy=$j(document).scrollTop();}else{var wx=o.pp.offsetWidth+o.po.left-20;var sx=o.pp.scrollLeft;var wy=o.pp.offsetHeight+o.po.top-20;var sy=o.pp.scrollTop;}
ui.draggable.pos[0]-=((ui.draggable.rpos[0]-o.cursorAt.left-wx+t.offsetWidth+o.margins.right)-sx>0||(ui.draggable.rpos[0]-o.cursorAt.left+o.margins.left)-sx<0)?(t.offsetWidth+o.margins.left+o.margins.right-o.cursorAt.left*2):0;ui.draggable.pos[1]-=((ui.draggable.rpos[1]-o.cursorAt.top-wy+t.offsetHeight+o.margins.bottom)-sy>0||(ui.draggable.rpos[1]-o.cursorAt.top+o.margins.top)-sy<0)?(t.offsetHeight+o.margins.top+o.margins.bottom-o.cursorAt.top*2):0;});})(jQuery);(function($j){$j.extend($j.expr[':'],{droppable:"(' '+a.className+' ').indexOf(' ui-droppable ')"});var methods="destroy,enable,disable".split(",");for(var i=0;i<methods.length;i++){var cur=methods[i],f;eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-droppable")) jQuery.data(this, "ui-droppable")["'+cur+'"](a); }); }');$j.fn["droppable"+cur.substr(0,1).toUpperCase()+cur.substr(1)]=f;};$j.fn.droppableInstance=function(){if($j(this[0]).is(".ui-droppable"))return $j.data(this[0],"ui-droppable");return false;};$j.fn.droppable=function(o){return this.each(function(){new $j.ui.droppable(this,o);});}
$j.ui.droppable=function(el,o){if(!o)var o={};this.element=el;if($j.browser.msie)el.droppable=1;$j.data(el,"ui-droppable",this);this.options={};$j.extend(this.options,o);var accept=o.accept;$j.extend(this.options,{accept:o.accept&&o.accept.constructor==Function?o.accept:function(d){return $j(d).is(accept);},tolerance:o.tolerance||'intersect'});o=this.options;var self=this;this.mouseBindings=[function(e){return self.move.apply(self,[e]);},function(e){return self.drop.apply(self,[e]);}];$j(this.element).bind("mousemove",this.mouseBindings[0]);$j(this.element).bind("mouseup",this.mouseBindings[1]);$j.ui.ddmanager.droppables.push({item:this,over:0,out:1});$j(this.element).addClass("ui-droppable");};$j.extend($j.ui.droppable.prototype,{plugins:{},prepareCallbackObj:function(c){return{draggable:c,droppable:this,element:c.element,helper:c.helper,options:this.options}},destroy:function(){$j(this.element).removeClass("ui-droppable").removeClass("ui-droppable-disabled");$j(this.element).unbind("mousemove",this.mouseBindings[0]);$j(this.element).unbind("mouseup",this.mouseBindings[1]);for(var i=0;i<$j.ui.ddmanager.droppables.length;i++){if($j.ui.ddmanager.droppables[i].item==this)$j.ui.ddmanager.droppables.splice(i,1);}},enable:function(){$j(this.element).removeClass("ui-droppable-disabled");this.disabled=false;},disable:function(){$j(this.element).addClass("ui-droppable-disabled");this.disabled=true;},move:function(e){if(!$j.ui.ddmanager.current)return;var o=this.options;var c=$j.ui.ddmanager.current;var findCurrentTarget=function(e){if(e.currentTarget)return e.currentTarget;var el=e.srcElement;do{if(el.droppable)return el;el=el.parentNode;}while(el);}
if(c&&o.accept(c.element))c.currentTarget=findCurrentTarget(e);c.drag.apply(c,[e]);e.stopPropagation?e.stopPropagation():e.cancelBubble=true;},over:function(e){var c=$j.ui.ddmanager.current;if(!c||c.element==this.element)return;var o=this.options;if(o.accept(c.element)){$j.ui.plugin.call(this,'over',[e,this.prepareCallbackObj(c)]);$j(this.element).triggerHandler("dropover",[e,this.prepareCallbackObj(c)],o.over);}},out:function(e){var c=$j.ui.ddmanager.current;if(!c||c.element==this.element)return;var o=this.options;if(o.accept(c.element)){$j.ui.plugin.call(this,'out',[e,this.prepareCallbackObj(c)]);$j(this.element).triggerHandler("dropout",[e,this.prepareCallbackObj(c)],o.out);}},drop:function(e){var c=$j.ui.ddmanager.current;if(!c||c.element==this.element)return;var o=this.options;if(o.accept(c.element)){if(o.greedy&&!c.slowMode){if(c.currentTarget==this.element){$j.ui.plugin.call(this,'drop',[e,{draggable:c,droppable:this,element:c.element,helper:c.helper}]);$j(this.element).triggerHandler("drop",[e,{draggable:c,droppable:this,element:c.element,helper:c.helper}],o.drop);}}else{$j.ui.plugin.call(this,'drop',[e,this.prepareCallbackObj(c)]);$j(this.element).triggerHandler("drop",[e,this.prepareCallbackObj(c)],o.drop);}}},activate:function(e){var c=$j.ui.ddmanager.current;$j.ui.plugin.call(this,'activate',[e,this.prepareCallbackObj(c)]);if(c)$j(this.element).triggerHandler("dropactivate",[e,this.prepareCallbackObj(c)],this.options.activate);},deactivate:function(e){var c=$j.ui.ddmanager.current;$j.ui.plugin.call(this,'deactivate',[e,this.prepareCallbackObj(c)]);if(c)$j(this.element).triggerHandler("dropdeactivate",[e,this.prepareCallbackObj(c)],this.options.deactivate);}});$j.ui.intersect=function(oDrag,oDrop,toleranceMode){if(!oDrop.offset)
return false;var x1=oDrag.rpos[0]-oDrag.options.cursorAt.left+oDrag.options.margins.left,x2=x1+oDrag.helperSize.width,y1=oDrag.rpos[1]-oDrag.options.cursorAt.top+oDrag.options.margins.top,y2=y1+oDrag.helperSize.height;var l=oDrop.offset.left,r=l+oDrop.item.element.offsetWidth,t=oDrop.offset.top,b=t+oDrop.item.element.offsetHeight;switch(toleranceMode){case'fit':return(l<x1&&x2<r&&t<y1&&y2<b);break;case'intersect':return(l<x1+(oDrag.helperSize.width/2)&&x2-(oDrag.helperSize.width/2)<r&&t<y1+(oDrag.helperSize.height/2)&&y2-(oDrag.helperSize.height/2)<b);break;case'pointer':return(l<oDrag.rpos[0]&&oDrag.rpos[0]<r&&t<oDrag.rpos[1]&&oDrag.rpos[1]<b);break;case'touch':return((l<x1&&x1<r&&t<y1&&y1<b)||(l<x1&&x1<r&&t<y2&&y2<b)||(l<x2&&x2<r&&t<y1&&y1<b)||(l<x2&&x2<r&&t<y2&&y2<b));break;default:return false;break;}}})(jQuery);(function($j){$j.ui.plugin.add("droppable","activate","activeClass",function(e,ui){$j(this).addClass(ui.options.activeClass);});$j.ui.plugin.add("droppable","deactivate","activeClass",function(e,ui){$j(this).removeClass(ui.options.activeClass);});$j.ui.plugin.add("droppable","drop","activeClass",function(e,ui){$j(this).removeClass(ui.options.activeClass);});$j.ui.plugin.add("droppable","over","hoverClass",function(e,ui){$j(this).addClass(ui.options.hoverClass);});$j.ui.plugin.add("droppable","out","hoverClass",function(e,ui){$j(this).removeClass(ui.options.hoverClass);});$j.ui.plugin.add("droppable","drop","hoverClass",function(e,ui){$j(this).removeClass(ui.options.hoverClass);});})(jQuery);if(window.Node&&Node.prototype&&!Node.prototype.contains){Node.prototype.contains=function(arg){return!!(this.compareDocumentPosition(arg)&16)}}
(function($j){$j.extend($j.expr[':'],{sortable:"(' '+a.className+' ').indexOf(' ui-sortable ')"});$j.fn.sortable=function(o){return this.each(function(){new $j.ui.sortable(this,o);});}
var methods="destroy,enable,disable,refresh".split(",");for(var i=0;i<methods.length;i++){var cur=methods[i],f;eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-sortable")) jQuery.data(this, "ui-sortable")["'+cur+'"](a); }); }');$j.fn["sortable"+cur.substr(0,1).toUpperCase()+cur.substr(1)]=f;};$j.fn.sortableInstance=function(){if($j(this[0]).is(".ui-sortable"))return $j.data(this[0],"ui-sortable");return false;};$j.ui.sortable=function(el,o){this.element=el;this.set=[];var options={};var self=this;$j.data(this.element,"ui-sortable",this);$j(el).addClass("ui-sortable");$j.extend(options,o);$j.extend(options,{items:options.items||'> li',smooth:options.smooth!=undefined?options.smooth:true,helper:'clone',containment:options.containment?(options.containment=='sortable'?el:options.containment):null,zIndex:options.zIndex||1000,_start:function(h,p,c,t,e){self.start.apply(t,[self,e]);},_beforeStop:function(h,p,c,t,e){self.stop.apply(t,[self,e]);},_drag:function(h,p,c,t,e){self.drag.apply(t,[self,e]);},startCondition:function(){return!self.disabled;}});var items=$j(options.items,el);options.floating=/left|right/.test(items.css('float'));if($j(el).css('position')=='static')$j(el).css('position','relative');options.offset=$j(el).offset({border:false});items.each(function(){new $j.ui.mouseInteraction(this,options);});items.each(function(){self.set.push([this,null]);});this.options=options;}
$j.extend($j.ui.sortable.prototype,{plugins:{},currentTarget:null,lastTarget:null,prepareCallbackObj:function(self,that){if(!self.pos)self.pos=[0,0];return{helper:self.helper,position:{left:self.pos[0],top:self.pos[1]},offset:self.options.cursorAt,draggable:self,current:that,options:self.options}},refresh:function(){var self=this;var items=$j(this.options.items,this.element);var unique=[];items.each(function(){old=false;for(var i=0;i<self.set.length;i++){if(self.set[i][0]==this)old=true;}
if(!old)unique.push(this);});for(var i=0;i<unique.length;i++){new $j.ui.mouseInteraction(unique[i],self.options);}
this.set=[];items.each(function(){self.set.push([this,null]);});},destroy:function(){$j(this.element).removeClass("ui-sortable").removeClass("ui-sortable-disabled");$j(this.options.items,this.element).mouseInteractionDestroy();},enable:function(){$j(this.element).removeClass("ui-sortable-disabled");this.disabled=false;},disable:function(){$j(this.element).addClass("ui-sortable-disabled");this.disabled=true;},start:function(that,e){var o=this.options;if(o.hoverClass){that.helper=$j('<div class="'+o.hoverClass+'"></div>').appendTo('body').css({height:this.element.offsetHeight+'px',width:this.element.offsetWidth+'px',position:'absolute'});}
if(o.zIndex){if($j(this.helper).css("zIndex"))o.ozIndex=$j(this.helper).css("zIndex");$j(this.helper).css('zIndex',o.zIndex);}
that.firstSibling=$j(this.element).prev()[0];$j(this.element).triggerHandler("sortstart",[e,that.prepareCallbackObj(this)],o.start);$j(this.element).css('visibility','hidden');return false;},stop:function(that,e){var o=this.options;var self=this;o.beQuietAtEnd=true;if(o.smooth){var os=$j(this.element).offset();$j(this.helper).animate({left:os.left-o.po.left,top:os.top-o.po.top},500,stopIt);}else{stopIt();}
function stopIt(){$j(self.element).css('visibility','visible');if(that.helper)that.helper.remove();if(self.helper!=self.element)$j(self.helper).remove();if(o.ozIndex)
$j(self.helper).css('zIndex',o.ozIndex);if($j(self.element).prev()[0]!=that.firstSibling){$j(self.element).triggerHandler("sortupdate",[e,that.prepareCallbackObj(self,that)],o.update);}
$j(self.element).triggerHandler("sortstop",[e,that.prepareCallbackObj(self,that)],o.stop);}
return false;},drag:function(that,e){var o=this.options;this.pos=[this.pos[0]-(o.cursorAt.left?o.cursorAt.left:0),this.pos[1]-(o.cursorAt.top?o.cursorAt.top:0)];var nv=$j(this.element).triggerHandler("sort",[e,that.prepareCallbackObj(this)],o.sort);var nl=(nv&&nv.left)?nv.left:this.pos[0];var nt=(nv&&nv.top)?nv.top:this.pos[1];var m=that.set;var p=this.pos[1];for(var i=0;i<m.length;i++){var ci=$j(m[i][0]);var cio=m[i][0];if(this.element.contains(cio))continue;var cO=ci.offset();cO={top:cO.top,left:cO.left};var mb=function(e){if(true||o.lba!=cio){ci.before(e);o.lba=cio;}}
var ma=function(e){if(true||o.laa!=cio){ci.after(e);o.laa=cio;}}
if(o.floating){var overlap=((cO.left-(this.pos[0]+(this.options.po?this.options.po.left:0)))/this.helper.offsetWidth);if(!(cO.top<this.pos[1]+(this.options.po?this.options.po.top:0)+cio.offsetHeight/2&&cO.top+cio.offsetHeight>this.pos[1]+(this.options.po?this.options.po.top:0)+cio.offsetHeight/2))continue;}else{var overlap=((cO.top-(this.pos[1]+(this.options.po?this.options.po.top:0)))/this.helper.offsetHeight);if(!(cO.left<this.pos[0]+(this.options.po?this.options.po.left:0)+cio.offsetWidth/2&&cO.left+cio.offsetWidth>this.pos[0]+(this.options.po?this.options.po.left:0)+cio.offsetWidth/2))continue;}
if(overlap>=0&&overlap<=0.5){ci.prev().length?ma(this.element):mb(this.element);break;}
if(overlap<0&&overlap>-0.5){ci.next()[0]==this.element?mb(this.element):ma(this.element);break;}}




if($j(this.element).prev()[0]!=that.lastSibling){$j(this.element).triggerHandler("sortchange",[e,that.prepareCallbackObj(this,that)],this.options.change);that.lastSibling=$j(this.element).prev()[0];}
if(that.helper){var to=$j(this.element).offset();that.helper.css({top:to.top+'px',left:to.left+'px'});}
$j(this.helper).css('left',nl+'px').css('top',nt+'px');return false;}});})(jQuery);(function($j)
{$j.extend($j.expr[':'],{selectable:"(' '+a.className+' ').indexOf(' ui-selectable ')"});$j.extend($j.expr[':'],{selectee:"(' '+a.className+' ').indexOf(' ui-selectee ')"});$j.fn.selectable=function(o){return this.each(function(){if(!$j(this).is(".ui-selectable"))new $j.ui.selectable(this,o);});}
$j.ui.selectable=function(el,o){var options={filter:'*'};var o=o||{};$j.extend(options,o);this.element=el;var self=this;self.dragged=false;$j.extend(options,{helper:function(){return $j(document.createElement('div')).css({border:'1px dotted black'});},_start:function(h,p,c,t,e){self.start.apply(t,[self,e]);},_drag:function(h,p,c,t,e){self.dragged=true;self.drag.apply(t,[self,e]);},_stop:function(h,p,c,t,e){self.stop.apply(t,[self,e]);self.dragged=false;}});this.mouse=new $j.ui.mouseInteraction(el,options);$j(this.element).addClass("ui-selectable");$j(this.element).children(options.filter).addClass("ui-selectee");}
$j.extend($j.ui.selectable.prototype,{plugins:{},start:function(self,ev){$j(self.mouse.helper).css({'z-index':100,position:'absolute',left:ev.clientX,top:ev.clientY,width:0,height:0});if(ev.ctrlKey){if($j(ev.target).is('.ui-selected')){$j(ev.target).removeClass('ui-selected').addClass('ui-unselecting');$j(self.element).triggerHandler("selectableunselecting",[ev,{selectable:self.element,unselecting:ev.target,options:this.options}],this.options.unselecting);}}else{self.unselecting(self,ev,this.options);self.selectingTarget(self,ev,this.options);}},drag:function(self,ev){var x1=self.mouse.opos[0],y1=self.mouse.opos[1],x2=ev.pageX,y2=ev.pageY;if(x1>x2){var tmp=x2;x2=x1;x1=tmp;}
if(y1>y2){var tmp=y2;y2=y1;y1=tmp;}
$j(self.mouse.helper).css({left:x1,top:y1,width:x2-x1,height:y2-y1});self.selectingTarget(self,ev,this.options);},stop:function(self,ev){var options=this.options;$j('.ui-selecting',self.element).each(function(){$j(this).removeClass('ui-selecting').addClass('ui-selected');$j(self.element).triggerHandler("selectableselected",[ev,{selectable:self.element,selected:this,options:options}],options.selected);});$j('.ui-unselecting',self.element).each(function(){$j(this).removeClass('ui-unselecting');$j(self.element).triggerHandler("selectableunselected",[ev,{selectable:self.element,unselected:this,options:options}],options.unselected);});},unselecting:function(self,ev,options){$j('.ui-selected',self.element).each(function(){if(this!=ev.target){$j(this).removeClass('ui-selected').addClass('ui-unselecting');$j(self.element).triggerHandler("selectableunselecting",[ev,{selectable:self.element,unselecting:this,options:options}],options.unselecting);}});},selectingTarget:function(self,ev,options){var target=$j(ev.target);if(target.is('.ui-selectee:not(.ui-selecting)')){target.removeClass('ui-selected').removeClass('ui-unselecting').addClass('ui-selecting');$j(self.element).triggerHandler("selectableselecting",[ev,{selectable:self.element,selecting:ev.target,options:options}],options.selecting);}}});})(jQuery);(function($j){$j.extend($j.expr[':'],{resizable:"(' '+a.className+' ').indexOf(' ui-resizable ')"});$j.fn.resizable=function(o){return this.each(function(){if(!$j(this).is(".ui-resizable"))new $j.ui.resizable(this,o);});}
var methods="destroy,enable,disable".split(",");for(var i=0;i<methods.length;i++){var cur=methods[i],f;eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-resizable")) jQuery.data(this, "ui-resizable")["'+cur+'"](a); if(jQuery(this.parentNode).is(".ui-resizable")) jQuery.data(this, "ui-resizable")["'+cur+'"](a); }); }');$j.fn["resizable"+cur.substr(0,1).toUpperCase()+cur.substr(1)]=f;};$j.fn.resizableInstance=function(){if($j(this[0]).is(".ui-resizable")||$j(this[0].parentNode).is(".ui-resizable"))return $j.data(this[0],"ui-resizable");return false;};$j.ui.resizable=function(el,o){var options={};o=o||{};$j.extend(options,o);this.element=el;var self=this;$j.data(this.element,"ui-resizable",this);if(options.proxy){var helper=function(e,that){var helper=$j('<div></div>').css({width:$j(this).width(),height:$j(this).height(),position:'absolute',left:that.options.co.left,top:that.options.co.top}).addClass(that.options.proxy);return helper;}}else{var helper="original";}
if(options.containment){if(options.containment.left!=undefined||options.containment.constructor==Array)return;if(options.containment=='parent')options.containment=this.element.parentNode;if(options.containment=='document'){options.containment=[0,0,$j(document).width(),($j(document).height()||document.body.parentNode.scrollHeight)];}else{var ce=$j(options.containment)[0];var co=$j(options.containment).offset({border:false});options.containment=[co.left,co.top,co.left+(ce.offsetWidth||ce.scrollWidth),co.top+(ce.offsetHeight||ce.scrollHeight)];}}
if(el.nodeName.match(/textarea|input|select|button|img/i))options.destructive=true;if(options.destructive){$j(el).wrap('<div class="ui-wrapper"  style="position: relative; width: '+$j(el).outerWidth()+'px; height: '+$j(el).outerHeight()+';"></div>');var oel=el;el=el.parentNode;this.element=el;$j(el).css({marginLeft:$j(oel).css("marginLeft"),marginTop:$j(oel).css("marginTop"),marginRight:$j(oel).css("marginRight"),marginBottom:$j(oel).css("marginBottom")});$j(oel).css({marginLeft:0,marginTop:0,marginRight:0,marginBottom:0});o.proportionallyResize=o.proportionallyResize||[];o.proportionallyResize.push(oel);var b=[parseInt($j(oel).css('borderTopWidth')),parseInt($j(oel).css('borderRightWidth')),parseInt($j(oel).css('borderBottomWidth')),parseInt($j(oel).css('borderLeftWidth'))];}else{var b=[0,0,0,0];}
if(options.destructive||!$j(".ui-resizable-handle",el).length){var t=function(a,b){$j(el).append("<div class='ui-resizable-"+a+" ui-resizable-handle' style='"+b+"'></div>");};t('e','right: '+b[1]+'px;'+(options.zIndex?'z-index: '+options.zIndex+';':''));t('s','bottom: '+b[1]+'px;'+(options.zIndex?'z-index: '+options.zIndex+';':''));t('se','bottom: '+b[2]+'px; right: '+b[1]+'px;'+(options.zIndex?'z-index: '+options.zIndex+';':''));}
options.modifyThese=[];if(o.proportionallyResize){options.proportionallyResize=o.proportionallyResize.slice(0);var propRes=options.proportionallyResize;for(var i in propRes){if(propRes[i].constructor==String)
propRes[i]=$j(propRes[i],el);if(!$j(propRes[i]).length)continue;var x=$j(propRes[i]).width()-$j(el).width();var y=$j(propRes[i]).height()-$j(el).height();options.modifyThese.push([$j(propRes[i]),x,y]);}}
options.handles={};if(!o.handles)o.handles={n:'.ui-resizable-n',e:'.ui-resizable-e',s:'.ui-resizable-s',w:'.ui-resizable-w',se:'.ui-resizable-se',sw:'.ui-resizable-sw',ne:'.ui-resizable-ne',nw:'.ui-resizable-nw'};for(var i in o.handles){options.handles[i]=o.handles[i];}
for(var i in options.handles){if(options.handles[i].constructor==String)
options.handles[i]=$j(options.handles[i],el);if(!$j(options.handles[i]).length)continue;$j(options.handles[i]).bind('mousedown',function(e){self.interaction.options.axis=this.resizeAxis;})[0].resizeAxis=i;}
if(o.autohide)
$j(this.element).addClass("ui-resizable-autohide").hover(function(){$j(this).removeClass("ui-resizable-autohide");},function(){if(self.interaction.options.autohide&&!self.interaction.init)$j(this).addClass("ui-resizable-autohide");});if(o.aspectRatio&&(o.aspectRatio=='preserve'||o.aspectRatio===true))
options.aspectRatio=$j(this.element).width()/$j(this.element).height();$j.extend(options,{helper:helper,nonDestructive:true,dragPrevention:'input,button,select',minHeight:options.minHeight||50,minWidth:options.minWidth||100,aspectRatio:options.aspectRatio||false,startCondition:function(e){if(self.disabled)return false;for(var i in options.handles){if($j(options.handles[i])[0]==e.target)return true;}
return false;},_start:function(h,p,c,t,e){self.start.apply(t,[self,e]);},_beforeStop:function(h,p,c,t,e){self.stop.apply(t,[self,e]);},_drag:function(h,p,c,t,e){self.drag.apply(t,[self,e]);}});this.interaction=new $j.ui.mouseInteraction(el,options);$j(this.element).addClass("ui-resizable");}
$j.extend($j.ui.resizable.prototype,{plugins:{},prepareCallbackObj:function(self){return{helper:self.helper,resizable:self,axis:self.options.axis,options:self.options}},destroy:function(){$j(this.element).removeClass("ui-resizable").removeClass("ui-resizable-disabled");this.interaction.destroy();},enable:function(){$j(this.element).removeClass("ui-resizable-disabled");this.disabled=false;},disable:function(){$j(this.element).addClass("ui-resizable-disabled");this.disabled=true;},start:function(that,e){this.options.originalSize=[$j(this.element).width(),$j(this.element).height()];this.options.originalPosition=$j(this.element).css("position");this.options.originalPositionValues=$j(this.element).position();if(this.options.modifyThese.length==0||!this.options.modifyThese[this.options.modifyThese.length-1][0].is('.ui-resizable'))
this.options.modifyThese.push([$j(this.helper),0,0]);$j(that.element).triggerHandler("resizestart",[e,that.prepareCallbackObj(this)],this.options.start);return false;},stop:function(that,e){var o=this.options;$j(that.element).triggerHandler("resizestop",[e,that.prepareCallbackObj(this)],this.options.stop);if(o.proxy){$j(this.element).css({width:$j(this.helper).width(),height:$j(this.helper).height()});if(o.originalPosition=="absolute"||o.originalPosition=="fixed")
$j(this.element).css({top:$j(this.helper).css("top"),left:$j(this.helper).css("left")});}
return false;},drag:function(that,e){var o=this.options;var rel=(o.originalPosition!="absolute"&&o.originalPosition!="fixed");var co=rel?o.co:this.options.originalPositionValues;var p=o.originalSize;this.pos=rel?[this.rpos[0]-o.cursorAt.left,this.rpos[1]-o.cursorAt.top]:[this.pos[0]-o.cursorAt.left,this.pos[1]-o.cursorAt.top];var nw=p[0]+(this.pos[0]-co.left);var nh=p[1]+(this.pos[1]-co.top);if(e.shiftKey&&!o.aspectRatio)o.aspectRatio=p[0]/p[1];if(o.axis){switch(o.axis){case'e':nh=p[1];break;case's':nw=p[0];break;case'n':case'ne':if(!o.proxy&&(o.originalPosition!="absolute"&&o.originalPosition!="fixed"))return false;if(o.axis=='n')nw=p[0];var mod=(this.pos[1]-co.top);nh=nh-(mod*2);mod=nh<=o.minHeight?p[1]-o.minHeight:(nh>=o.maxHeight?0-(o.maxHeight-p[1]):mod);if(o.containment&&co.top+mod<o.containment[1]-o.po.top){mod=(o.containment[1]-o.po.top)-co.top;nh=nh+this.pos[1]-(o.containment[1]-o.po.top);}
$j(this.helper).css('top',co.top+mod);break;case'w':case'sw':if(!o.proxy&&(o.originalPosition!="absolute"&&o.originalPosition!="fixed"))return false;if(o.axis=='w')nh=p[1];var mod=(this.pos[0]-co.left);nw=nw-(mod*2);mod=nw<=o.minWidth?p[0]-o.minWidth:(nw>=o.maxWidth?0-(o.maxWidth-p[0]):mod);if(o.containment&&co.left+mod<o.containment[0]-o.po.left){mod=(o.containment[0]-o.po.left)-co.left;nw=nw+this.pos[0]-(o.containment[0]-o.po.left);}
$j(this.helper).css('left',co.left+mod);break;case'nw':if(!o.proxy&&(o.originalPosition!="absolute"&&o.originalPosition!="fixed"))return false;var modx=(this.pos[0]-co.left);nw=nw-(modx*2);modx=nw<=o.minWidth?p[0]-o.minWidth:(nw>=o.maxWidth?0-(o.maxWidth-p[0]):modx);var mody=(this.pos[1]-co.top);nh=nh-(mody*2);mody=nh<=o.minHeight?p[1]-o.minHeight:(nh>=o.maxHeight?0-(o.maxHeight-p[1]):mody);if(o.containment&&co.top+mody<o.containment[1]-o.po.top){mody=(o.containment[1]-o.po.top)-co.top;nh=nh+this.pos[1]-(o.containment[1]-o.po.top);}
if(o.containment&&co.left+modx<o.containment[0]-o.po.left){modx=(o.containment[0]-o.po.left)-co.left;nw=nw+this.pos[0]-(o.containment[0]-o.po.left);}
$j(this.helper).css({left:co.left+modx,top:co.top+mody});break;}}
if(e.shiftKey)nh=nw*(1/o.aspectRatio);if(o.minWidth)nw=nw<=o.minWidth?o.minWidth:nw;if(o.minHeight)nh=nh<=o.minHeight?o.minHeight:nh;if(o.maxWidth)nw=nw>=o.maxWidth?o.maxWidth:nw;if(o.maxHeight)nh=nh>=o.maxHeight?o.maxHeight:nh;if(e.shiftKey)nh=nw*(1/o.aspectRatio);var modifier=$j(that.element).triggerHandler("resize",[e,that.prepareCallbackObj(this)],o.resize);if(!modifier)modifier={};var left_handle_pos=co.left<this.pos[0]?co.left:this.pos[0];var top_handle_pos=co.top<this.pos[1]?co.top:this.pos[1];if(o.containment&&left_handle_pos+nw>o.containment[2]-o.po.left)
nw=(o.containment[2]-o.po.left)-left_handle_pos;if(o.containment&&top_handle_pos+nh>o.containment[3]-o.po.top)
nh=(o.containment[3]-o.po.top)-top_handle_pos;for(var i in this.options.modifyThese){var c=this.options.modifyThese[i];c[0].css({width:modifier.width?modifier.width+c[1]:nw+c[1],height:modifier.height?modifier.height+c[2]:nh+c[2]});}
return false;}});})(jQuery);(function($j){$j.ui=$j.ui||{};$j.ui.accordion={};$j.extend($j.ui.accordion,{defaults:{selectedClass:"selected",alwaysOpen:true,animated:'slide',event:"click",header:"a",autoheight:true},animations:{slide:function(settings,additions){settings=$j.extend({easing:"swing",duration:300},settings,additions);if(!settings.toHide.size()){settings.toShow.animate({height:"show"},{duration:settings.duration,easing:settings.easing,complete:settings.finished});return;}
var hideHeight=settings.toHide.height(),showHeight=settings.toShow.height(),difference=showHeight/hideHeight;settings.toShow.css({height:0,overflow:'hidden'}).show();settings.toHide.filter(":hidden").each(settings.finished).end().filter(":visible").animate({height:"hide"},{step:function(now){settings.toShow.height((hideHeight-(now))*difference);},duration:settings.duration,easing:settings.easing,complete:settings.finished});},bounceslide:function(settings){this.slide(settings,{easing:settings.down?"bounceout":"swing",duration:settings.down?1000:200});},easeslide:function(settings){this.slide(settings,{easing:"easeinout",duration:700})}}});$j.fn.extend({accordion:function(settings){if(!this.length)
return this;settings=$j.extend({},$j.ui.accordion.defaults,settings);if(settings.navigation){var current=this.find("a").filter(function(){return this.href==location.href;});if(current.length){if(current.filter(settings.header).length){settings.active=current;}else{settings.active=current.parent().parent().prev();current.addClass("current");}}}
var container=this,headers=container.find(settings.header),active=findActive(settings.active),running=0;if(settings.fillSpace){var maxHeight=this.parent().height();headers.each(function(){maxHeight-=$j(this).outerHeight();});var maxPadding=0;headers.next().each(function(){maxPadding=Math.max(maxPadding,$j(this).innerHeight()-$j(this).height());}).height(maxHeight-maxPadding);}else if(settings.autoheight){var maxHeight=0;headers.next().each(function(){maxHeight=Math.max(maxHeight,$j(this).outerHeight());}).height(maxHeight);}
headers.not(active||"").next().hide();active.parent().andSelf().addClass(settings.selectedClass);function findActive(selector){return selector!=undefined?typeof selector=="number"?headers.filter(":eq("+selector+")"):headers.not(headers.not(selector)):selector===false?$j("<div>"):headers.filter(":eq(0)");}
function toggle(toShow,toHide,data,clickedActive,down){var finished=function(cancel){running=cancel?0:--running;if(running)
return;container.trigger("change",data);};running=toHide.size()==0?toShow.size():toHide.size();if(settings.animated){if(!settings.alwaysOpen&&clickedActive){toShow.slideToggle(settings.animated);finished(true);}else{$j.ui.accordion.animations[settings.animated]({toShow:toShow,toHide:toHide,finished:finished,down:down});}}else{if(!settings.alwaysOpen&&clickedActive){toShow.toggle();}else{toHide.hide();toShow.show();}
finished(true);}}
function clickHandler(event){if(!event.target&&!settings.alwaysOpen){active.toggleClass(settings.selectedClass);var toHide=active.next();var toShow=active=$j([]);toggle(toShow,toHide);return;}
var clicked=$j(event.target);if(clicked.parents(settings.header).length)
while(!clicked.is(settings.header))
clicked=clicked.parent();var clickedActive=clicked[0]==active[0];if(running||(settings.alwaysOpen&&clickedActive)||!clicked.is(settings.header))
return;active.parent().andSelf().toggleClass(settings.selectedClass);if(!clickedActive){clicked.parent().andSelf().addClass(settings.selectedClass);}
var toShow=clicked.next(),toHide=active.next(),data=[clicked,active,toShow,toHide],down=headers.index(active[0])>headers.index(clicked[0]);active=clickedActive?$j([]):clicked;toggle(toShow,toHide,data,clickedActive,down);return!toShow.length;};function activateHandler(event,index){if(arguments.length==1)
return;clickHandler({target:findActive(index)[0]});};return container.bind(settings.event||"",clickHandler).bind("activate",activateHandler);},activate:function(index){return this.trigger('activate',[index]);},unaccordion:function(){return this.find("*").andSelf().unbind().end().end();}});})(jQuery);(function($j)
{$j.ui=$j.ui||{};$j.fn.dialog=function(o){return this.dialogInit(o).dialogOpen();}
$j.fn.dialogInit=function(o){return this.each(function(){if(!$j(this).is(".ui-dialog")){$j.ui.dialogInit(this,o);}});}
$j.fn.dialogOpen=function(){return this.each(function(){var contentEl;if($j(this).parents(".ui-dialog").length)contentEl=this;if(!contentEl&&$j(this).is(".ui-dialog"))contentEl=$j('.ui-dialog-content',this)[0];$j.ui.dialogOpen(contentEl)});}
$j.fn.dialogClose=function(){return this.each(function(){var contentEl;var closeEl=$j(this);if(closeEl.is('.ui-dialog-content')){var contentEl=closeEl;}else if(closeEl.hasClass('ui-dialog')){contentEl=closeEl.find('.ui-dialog-content');}else{contentEl=closeEl.parents('.ui-dialog:first').find('.ui-dialog-content');}
$j.ui.dialogClose(contentEl[0]);});}
$j.ui.dialogInit=function(el,o){var options={width:300,height:200,minWidth:150,minHeight:100,position:'center',buttons:[],draggable:true,resizable:true};var o=o||{};$j.extend(options,o);this.element=el;var self=this;$j.data(this.element,"ui-dialog",this);var uiDialogContent=$j(el).addClass('ui-dialog-content');if(!uiDialogContent.parent().length){uiDialogContent.appendTo('body');}
uiDialogContent.wrap(document.createElement('div')).wrap(document.createElement('div'));var uiDialogContainer=uiDialogContent.parent().addClass('ui-dialog-container').css({position:'relative'});var uiDialog=uiDialogContainer.parent().addClass('ui-dialog').css({position:'absolute',width:options.width,height:options.height,overflow:'hidden'});if(options.resizable){uiDialog.append("<div class='ui-resizable-n ui-resizable-handle'></div>").append("<div class='ui-resizable-s ui-resizable-handle'></div>").append("<div class='ui-resizable-e ui-resizable-handle'></div>").append("<div class='ui-resizable-w ui-resizable-handle'></div>").append("<div class='ui-resizable-ne ui-resizable-handle'></div>").append("<div class='ui-resizable-se ui-resizable-handle'></div>").append("<div class='ui-resizable-sw ui-resizable-handle'></div>").append("<div class='ui-resizable-nw ui-resizable-handle'></div>");uiDialog.resizable({maxWidth:options.maxWidth,maxHeight:options.maxHeight,minWidth:options.minWidth,minHeight:options.minHeight});}
uiDialogContainer.prepend('<div class="ui-dialog-titlebar"></div>');var uiDialogTitlebar=$j('.ui-dialog-titlebar',uiDialogContainer);var title=(options.title)?options.title:(uiDialogContent.attr('title'))?uiDialogContent.attr('title'):'';uiDialogTitlebar.append('<span class="ui-dialog-title">'+title+'</span>');uiDialogTitlebar.append('<div class="ui-dialog-titlebar-close"></div>');$j('.ui-dialog-titlebar-close',uiDialogTitlebar).hover(function(){$j(this).addClass('ui-dialog-titlebar-close-hover');},function(){$j(this).removeClass('ui-dialog-titlebar-close-hover');}).mousedown(function(ev){ev.stopPropagation();}).click(function(){self.close();});var l=0;$j.each(options.buttons,function(){l=1;return false;});if(l==1){uiDialog.append('<div class="ui-dialog-buttonpane"></div>');var uiDialogButtonPane=$j('.ui-dialog-buttonpane',uiDialog);$j.each(options.buttons,function(name,value){var btn=$j(document.createElement('button')).text(name).click(value);uiDialogButtonPane.append(btn);});}
if(options.draggable){uiDialog.draggable({handle:'.ui-dialog-titlebar'});}
this.open=function(){uiDialog.appendTo('body');var wnd=$j(window),doc=$j(document),top=doc.scrollTop(),left=doc.scrollLeft();switch(options.position){case'center':top+=(wnd.height()/2)-(uiDialog.height()/2);left+=(wnd.width()/2)-(uiDialog.width()/2);break;case'top':top+=0;left+=(wnd.width()/2)-(uiDialog.width()/2);break;case'right':top+=(wnd.height()/2)-(uiDialog.height()/2);left+=(wnd.width())-(uiDialog.width());break;case'bottom':top+=(wnd.height())-(uiDialog.height());left+=(wnd.width()/2)-(uiDialog.width()/2);break;case'left':top+=(wnd.height()/2)-(uiDialog.height()/2);left+=0;break;}
top=top<doc.scrollTop()?doc.scrollTop():top;uiDialog.css({top:top,left:left});uiDialog.show();};this.close=function(){uiDialog.hide();};}
$j.ui.dialogOpen=function(el){$j.data(el,"ui-dialog").open();}
$j.ui.dialogClose=function(el){$j.data(el,"ui-dialog").close();}})(jQuery);(function($j){if(window['webforms']){$j(document).ready(function(){$j("input").each(function(){if(this.getAttribute("type")=="range"){var cur=$j(this);var slider=$j("<div class='ui-slider'></div>").css({width:cur.innerWidth()+"px",height:cur.innerHeight()+"px"}).insertAfter(cur);var handle=$j("<div class='ui-slider-handle'></div>").appendTo(slider);slider.css({"position":cur.css("position")=="absolute"?"absolute":"relative","left":cur.css("left"),"right":cur.css("right"),"zIndex":cur.css("zIndex"),"float":cur.css("float"),"clear":cur.css("clear")});cur.css({position:"absolute",opacity:0,top:"-1000px",left:"-1000px"});slider.slider({maxValue:cur.attr("max"),minValue:cur.attr("min"),startValue:this.getAttribute("value"),stepping:cur.attr("step"),change:function(e,ui){cur[0].value=ui.value;cur[0].setAttribute("value",ui.value);}});slider=slider.sliderInstance();cur.bind("keydown",function(e){var o=slider.interaction.options;switch(e.keyCode){case 37:slider.moveTo(slider.interaction.curValue+o.minValue-(o.stepping||1));break;case 39:slider.moveTo(slider.interaction.curValue+o.minValue+(o.stepping||1));break;}
if(e.keyCode!=9)return false;});};});});}
$j.extend($j.expr[':'],{slider:"(' '+a.className+' ').indexOf(' ui-slider ')"});$j.fn.slider=function(o){return this.each(function(){new $j.ui.slider(this,o);});}
var methods="destroy,enable,disable,moveTo".split(",");for(var i=0;i<methods.length;i++){var cur=methods[i],f;eval('f = function() { var a = arguments; return this.each(function() { if(jQuery(this).is(".ui-slider")) jQuery.data(this, "ui-slider")["'+cur+'"](a); }); }');$j.fn["slider"+cur.substr(0,1).toUpperCase()+cur.substr(1)]=f;};$j.fn.sliderInstance=function(){if($j(this[0]).is(".ui-slider"))return $j.data(this[0],"ui-slider");return false;};$j.ui.slider=function(el,o){var options={};o=o||{};$j.extend(options,o);$j.extend(options,{axis:o.axis||(el.offsetWidth<el.offsetHeight?'vertical':'horizontal'),maxValue:parseInt(o.maxValue)||100,minValue:parseInt(o.minValue)||0,startValue:parseInt(o.startValue)||0,_start:function(h,p,c,t,e){self.start.apply(t,[self,e]);},_beforeStop:function(h,p,c,t,e){self.stop.apply(t,[self,e]);},_drag:function(h,p,c,t,e){self.drag.apply(t,[self,e]);},startCondition:function(){return!self.disabled;}});var self=this;var o=options;$j.data(el,"ui-slider",this);o.stepping=parseInt(o.stepping)||(o.steps?o.maxValue/o.steps:0);o.realValue=(o.maxValue-o.minValue);this.handle=options.handle?$j(options.handle,el):$j('.ui-slider-handle',el);if(this.handle.length==1){this.interaction=new $j.ui.mouseInteraction(this.handle[0],options);this.multipleHandles=false;}else{this.interactions=[];this.handle.each(function(){self.interactions.push(new $j.ui.mouseInteraction(this,options));});this.multipleHandles=true;}
this.element=el;$j(this.element).addClass("ui-slider");if(o.axis=='horizontal'){this.parentSize=$j(this.element).outerWidth()-this.handle.outerWidth();this.prop='left';}
if(o.axis=='vertical'){this.parentSize=$j(this.element).outerHeight()-this.handle.outerHeight();this.prop='top';}
if(!this.multipleHandles){$j(el).bind('click',function(e){self.click.apply(self,[e]);});if(!isNaN(o.startValue))this.moveTo(o.startValue,options.realValue,null,false);}}
$j.extend($j.ui.slider.prototype,{currentTarget:null,lastTarget:null,destroy:function(){$j(this.element).removeClass("ui-slider").removeClass("ui-slider-disabled");this.interaction.destroy();},enable:function(){$j(this.element).removeClass("ui-slider-disabled");this.disabled=false;},disable:function(){$j(this.element).addClass("ui-slider-disabled");this.disabled=true;},nonvalidRange:function(self){for(var i=0;i<this.interactions.length;i++){if(self==this.interactions[i]){if(this.interactions[i-1]){if(this.interactions[i-1].curValue>this.interactions[i].curValue)return this.interactions[i-1].curValue;}
if(this.interactions[i+1]){if(this.interactions[i+1].curValue<this.interactions[i].curValue)return this.interactions[i+1].curValue;}}}
return false;},prepareCallbackObj:function(self,m){var cur=this;var func=function(){var retVal=[];for(var i=0;i<cur.interactions.length;i++){retVal.push((cur.interactions[i].curValue||0)+self.options.minValue);}
return retVal;};return{handle:self.helper,pixel:m,value:self.curValue+self.options.minValue,values:this.multipleHandles?func():self.curValue+self.options.minValue,slider:self}},click:function(e){var o=this.interaction.options;var pointer=[e.pageX,e.pageY];var offset=$j(this.interaction.element).offsetParent().offset({border:false});if(this.interaction.element==e.target||this.disabled)return;this.interaction.pickValue=this.interaction.curValue;this.drag.apply(this.interaction,[this,e,[pointer[0]-offset.left-this.handle[0].offsetWidth/2,pointer[1]-offset.top-this.handle[0].offsetHeight/2]]);if(this.interaction.pickValue!=this.interaction.curValue)
$j(this.element).triggerHandler("slidechange",[e,this.prepareCallbackObj(this.interaction)],o.change);},start:function(that,e){var o=this.options;$j(that.element).triggerHandler("slidestart",[e,that.prepareCallbackObj(this)],o.start);this.pickValue=this.curValue;return false;},stop:function(that,e){var o=this.options;$j(that.element).triggerHandler("slidestop",[e,that.prepareCallbackObj(this)],o.stop);if(this.pickValue!=this.curValue)$j(that.element).triggerHandler("slidechange",[e,that.prepareCallbackObj(this)],o.change);return false;},drag:function(that,e,pos){var o=this.options;this.pos=pos||[this.pos[0]-this.element.offsetWidth/2,this.pos[1]-this.element.offsetHeight/2];if(o.axis=='horizontal')var m=this.pos[0];if(o.axis=='vertical')var m=this.pos[1];var p=that.parentSize;var prop=that.prop;if(m<0)m=0;if(m>p)m=p;this.curValue=(Math.round((m/p)*o.realValue));if(o.stepping){this.curValue=Math.round(this.curValue/o.stepping)*o.stepping;m=((this.curValue)/o.realValue)*p;}
if(that.interactions){nonvalidRange=that.nonvalidRange(this);if(nonvalidRange){this.curValue=nonvalidRange;m=((this.curValue)/o.realValue)*p;}}
$j(this.element).css(prop,m+'px');$j(that.element).triggerHandler("slide",[e,that.prepareCallbackObj(this,m)],o.slide);return false;},moveTo:function(value,scale,changeslide,p){if(this.multipleHandles)return false;var o=this.interaction.options;var offset=$j(this.interaction.element).offsetParent().offset({border:false});this.interaction.pickValue=this.interaction.curValue;value=value-o.minValue;var modifier=scale||o.realValue;if(!p)var p=this.parentSize;var prop=this.prop;var m=Math.round(((value)/modifier)*p);if(m<0)m=0;if(m>p)m=p;this.interaction.curValue=(Math.round((m/p)*o.realValue));if(o.stepping){this.interaction.curValue=Math.round(this.interaction.curValue/o.stepping)*o.stepping;m=((this.interaction.curValue)/o.realValue)*p;}
$j(this.interaction.element).css(prop,m+'px');if(!changeslide&&this.interaction.pickValue!=this.interaction.curValue&&!p)
$j(this.element).triggerHandler("slidechange",[null,this.prepareCallbackObj(this.interaction)],o.change);if(changeslide)
$j(this.element).triggerHandler("slide",[null,this.prepareCallbackObj(this.interaction)],o.slide);}});})(jQuery);(function($j){$j.ui=$j.ui||{};$j.fn.tabs=function(initial,options){if(initial&&initial.constructor==Object){options=initial;initial=null;}
options=options||{};initial=initial&&initial.constructor==Number&&--initial||0;return this.each(function(){new $j.ui.tabs(this,$j.extend(options,{initial:initial}));});};$j.each(['Add','Remove','Enable','Disable','Click','Load','Href'],function(i,method){$j.fn['tabs'+method]=function(){var args=arguments;return this.each(function(){var instance=$j.ui.tabs.getInstance(this);instance[method.toLowerCase()].apply(instance,args);});};});$j.fn.tabsSelected=function(){var selected=-1;if(this[0]){var instance=$j.ui.tabs.getInstance(this[0]),$jlis=$j('li',this);selected=$jlis.index($jlis.filter('.'+instance.options.selectedClass)[0]);}
return selected>=0?++selected:-1;};$j.ui.tabs=function(el,options){this.source=el;this.options=$j.extend({initial:0,event:'click',disabled:[],cookie:null,unselected:false,unselect:options.unselected?true:false,spinner:'Loading&#8230;',cache:false,idPrefix:'tab-',fxSpeed:'normal',add:function(){},remove:function(){},enable:function(){},disable:function(){},click:function(){},hide:function(){},show:function(){},load:function(){},tabTemplate:'<li><a href="#{href}"><span>#{text}</span></a></li>',panelTemplate:'<div></div>',navClass:'ui-tabs-nav',selectedClass:'ui-tabs-selected',unselectClass:'ui-tabs-unselect',disabledClass:'ui-tabs-disabled',panelClass:'ui-tabs-panel',hideClass:'ui-tabs-hide',loadingClass:'ui-tabs-loading'},options);this.options.event+='.ui-tabs';this.options.cookie=$j.cookie&&$j.cookie.constructor==Function&&this.options.cookie;this.uuid='ui_tabs_'+$j.ui.tabs.prototype.count++;$j.ui.tabs.instances[this.uuid]=this;$j.data(el,'uiTabsUUID',this.uuid);this.tabify(true);};$j.ui.tabs.instances={};$j.ui.tabs.getInstance=function(el){return $j.ui.tabs.instances[$j.data(el,'uiTabsUUID')];};$j.extend($j.ui.tabs.prototype,{count:0,tabId:function(a,i){return a.title?a.title.replace(/\s/g,'_'):this.options.idPrefix+this.count+'-'+(i+1);},tabify:function(init){this.$jtabs=$j('a:first-child',this.source);this.$jpanels=$j([]);var self=this,o=this.options;this.$jtabs.each(function(i,a){if(a.hash&&a.hash.replace('#','')){self.$jpanels=self.$jpanels.add(a.hash);}
else{$j.data(a,'href',a.href);var id=self.tabId(a,i);a.href='#'+id;self.$jpanels=self.$jpanels.add($j('#'+id)[0]||$j(o.panelTemplate).attr('id',id).addClass(o.panelClass).insertAfter(self.$jpanels[i-1]||self.source));}});if(init){this.$jtabs.each(function(i,a){if(location.hash){if(a.hash==location.hash){o.initial=i;if($j.browser.msie||$j.browser.opera){var $jtoShow=$j(location.hash),toShowId=$jtoShow.attr('id');$jtoShow.attr('id','');setTimeout(function(){$jtoShow.attr('id',toShowId);},500);}
scrollTo(0,0);return false;}}else if(o.cookie){o.initial=parseInt($j.cookie(self.uuid))||0;return false;}else if($j(a).parent('li').is('.'+o.selectedClass)){o.initial=i;return false;}});$j(this.source).is('.'+o.navClass)||$j(this.source).addClass(o.navClass);this.$jpanels.each(function(){var $jthis=$j(this);$jthis.is('.'+o.panelClass)||$jthis.addClass(o.panelClass);});var $jlis=$j('li',this.source);this.$jpanels.addClass(o.hideClass);$jlis.removeClass(o.selectedClass);if(!o.unselected){this.$jpanels.slice(o.initial,o.initial+1).show();$jlis.slice(o.initial,o.initial+1).addClass(o.selectedClass);}
var href=this.$jtabs[o.initial]&&$j.data(this.$jtabs[o.initial],'href');if(href){this.load(o.initial+1,href);}
for(var i=0,position;position=o.disabled[i];i++){this.disable(position);}}
var showAnim={},showSpeed=o.fxShowSpeed||o.fxSpeed,hideAnim={},hideSpeed=o.fxHideSpeed||o.fxSpeed;if(o.fxSlide||o.fxFade){if(o.fxSlide){showAnim['height']='show';hideAnim['height']='hide';}
if(o.fxFade){showAnim['opacity']='show';hideAnim['opacity']='hide';}}else{if(o.fxShow){showAnim=o.fxShow;}else{showAnim['min-width']=0;showSpeed=1;}
if(o.fxHide){hideAnim=o.fxHide;}else{hideAnim['min-width']=0;hideSpeed=1;}}
var resetCSS={display:'',overflow:'',height:''};if(!$j.browser.msie){resetCSS['opacity']='';}
function hideTab(clicked,$jhide,$jshow){$jhide.animate(hideAnim,hideSpeed,function(){$jhide.addClass(o.hideClass).css(resetCSS);if($j.browser.msie&&hideAnim['opacity']){$jhide[0].style.filter='';}
o.hide(clicked,$jhide[0],$jshow&&$jshow[0]||null);if($jshow){showTab(clicked,$jshow,$jhide);}});}
function showTab(clicked,$jshow,$jhide){if(!(o.fxSlide||o.fxFade||o.fxShow)){$jshow.css('display','block');}
$jshow.animate(showAnim,showSpeed,function(){$jshow.removeClass(o.hideClass).css(resetCSS);if($j.browser.msie&&showAnim['opacity']){$jshow[0].style.filter='';}
o.show(clicked,$jshow[0],$jhide&&$jhide[0]||null);});}
function switchTab(clicked,$jhide,$jshow){$j(clicked).parents('li:eq(0)').addClass(o.selectedClass).siblings().removeClass(o.selectedClass);hideTab(clicked,$jhide,$jshow);}
this.$jtabs.unbind(o.event).bind(o.event,function(){var $jli=$j(this).parent('li'),$jhide=self.$jpanels.filter(':visible'),$jshow=$j(this.hash);if(($jli.is('.'+o.selectedClass)&&!o.unselect)||$jli.is('.'+o.disabledClass)||o.click(this,$jshow[0],$jhide[0])===false){this.blur();return false;}
if(o.cookie){$j.cookie(self.uuid,self.$jtabs.index(this),o.cookie);}
if(o.unselect){if($jli.is('.'+o.selectedClass)){$jli.removeClass(o.selectedClass);self.$jpanels.stop();hideTab(this,$jhide);this.blur();return false;}else if(!$jhide.length){$jli.addClass(o.selectedClass).addClass(o.unselectClass);self.$jpanels.stop();showTab(this,$jshow);this.blur();return false;}}
self.$jpanels.stop();if($jshow.length){if($j.data(this,'href')){var a=this;self.load(self.$jtabs.index(this)+1,$j.data(this,'href'),function(){switchTab(a,$jhide,$jshow);});}else{switchTab(this,$jhide,$jshow);}}else{throw'jQuery UI Tabs: Mismatching fragment identifier.';}
this.blur();return false;});},add:function(url,text,position){if(url&&text){var o=this.options;position=position||this.$jtabs.length;var $jli=$j(o.tabTemplate.replace(/#\{href\}/,url).replace(/#\{text\}/,text));if(url.indexOf('#')==0){var id=url.replace('#','')}else{var id=this.tabId($j('a:first-child',$jli)[0],position);}
var $jpanel=$j('#'+id);$jpanel=$jpanel.length&&$jpanel||$j(o.panelTemplate).attr('id',id).addClass(o.panelClass).addClass(o.hideClass);if(position>=this.$jtabs.length){$jli.appendTo(this.source);$jpanel.appendTo(this.source.parentNode);}else{$jli.insertBefore(this.$jtabs.slice(position-1,position).parent('li'));$jpanel.insertBefore(this.$jpanels[position-1]);}
this.tabify();if(this.$jtabs.length==1){$jli.addClass(o.selectedClass);$jpanel.removeClass(o.hideClass);var href=$j.data(this.$jtabs[0],'href');if(href){this.load(position+1,href);}}
o.add(this.$jtabs[position],this.$jpanels[position]);}else{throw'jQuery UI Tabs: Not enough arguments to add tab.';}},remove:function(position){if(position&&position.constructor==Number){var $jli=this.$jtabs.slice(position-1,position).parent('li').remove(),$jpanel=this.$jpanels.slice(position-1,position).remove(),o=this.options;if($jli.is('.'+o.selectedClass)&&this.$jtabs.length>1){this.click(position+(position<this.$jtabs.length?1:-1));}
this.tabify();o.remove($jli.end()[0],$jpanel[0]);}},enable:function(position){var $jli=this.$jtabs.slice(position-1,position).parent('li'),o=this.options;$jli.removeClass(o.disabledClass);if($j.browser.safari){$jli.css('display','inline-block');setTimeout(function(){$jli.css('display','block')},0)}
o.enable(this.$jtabs[position-1],this.$jpanels[position-1]);},disable:function(position){var o=this.options;this.$jtabs.slice(position-1,position).parent('li').addClass(o.disabledClass);o.disable(this.$jtabs[position-1],this.$jpanels[position-1]);},click:function(position){this.$jtabs.slice(position-1,position).trigger(this.options.event);},load:function(position,url,callback){var self=this,o=this.options,$ja=this.$jtabs.slice(position-1,position).addClass(o.loadingClass),a=$ja[0];$jspan=$j('span',a),text=$jspan.html();if(url&&url.constructor==Function){callback=url;url=null;}
if(url){$j.data(a,'href',url);}else{url=$j.data(a,'href');}
if(o.spinner){$jspan.html('<em>'+o.spinner+'</em>');}
setTimeout(function(){$j(a.hash).load(url,function(){if(o.spinner){$jspan.html(text);}
$ja.removeClass(o.loadingClass);if(callback&&callback.constructor==Function){callback();}
if(o.cache){$j.removeData(a,'href');}
o.load(self.$jtabs[position-1],self.$jpanels[position-1]);});},0);},href:function(position,href){$j.data(this.$jtabs.slice(position-1,position)[0],'href',href);}});})(jQuery);
(function($j){function Datepicker(){this.debug=false;this._nextId=0;this._inst=[];this._curInst=null;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this.regional=[];this.regional['']={clearText:'Clear',closeText:'Close',prevText:'&lt;Prev',nextText:'Next&gt;',currentText:'Today',dayNames:['Su','Mo','Tu','We','Th','Fr','Sa'],monthNames:['January','February','March','April','May','June','July','August','September','October','November','December'],dateFormat:'MDY/',firstDay:0};this._defaults={showOn:'focus',defaultDate:null,appendText:'',buttonText:'...',buttonImage:'',buttonImageOnly:false,closeAtTop:true,hideIfNoPrevNext:false,changeMonth:true,changeYear:true,yearRange:'-10:+10',changeFirstDay:true,showOtherMonths:false,useShortYear:false,shortYearCutoff:'+10',minDate:null,maxDate:null,speed:'medium',beforeShowDay:null,beforeShow:null,onSelect:null,numberOfMonths:1,stepMonths:1,rangeSelect:false,rangeSeparator:' - '};$j.extend(this._defaults,this.regional['']);this._datepickerDiv=$j('<div id="datepicker_div"></div>');}
$j.extend(Datepicker.prototype,{markerClassName:'hasDatepicker',log:function(){if(this.debug){console.log.apply('',arguments);}},_register:function(inst){var id=this._nextId++;this._inst[id]=inst;return id;},_getInst:function(id){return this._inst[id]||id;},setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this;},_doKeyDown:function(e){var inst=$j.datepicker._getInst(this._calId);if($j.datepicker._datepickerShowing){switch(e.keyCode){case 9:$j.datepicker.hideDatepicker('');break;case 13:$j.datepicker._selectDay(inst,inst._selectedMonth,inst._selectedYear,$j('td.datepicker_daysCellOver',inst._datepickerDiv)[0]);break;case 27:$j.datepicker.hideDatepicker(inst._get('speed'));break;case 33:$j.datepicker._adjustDate(inst,(e.ctrlKey?-1:-inst._get('stepMonths')),(e.ctrlKey?'Y':'M'));break;case 34:$j.datepicker._adjustDate(inst,(e.ctrlKey?+1:+inst._get('stepMonths')),(e.ctrlKey?'Y':'M'));break;case 35:if(e.ctrlKey)$j.datepicker._clearDate(inst);break;case 36:if(e.ctrlKey)$j.datepicker._gotoToday(inst);break;case 37:if(e.ctrlKey)$j.datepicker._adjustDate(inst,-1,'D');break;case 38:if(e.ctrlKey)$j.datepicker._adjustDate(inst,-7,'D');break;case 39:if(e.ctrlKey)$j.datepicker._adjustDate(inst,+1,'D');break;case 40:if(e.ctrlKey)$j.datepicker._adjustDate(inst,+7,'D');break;}}
else if(e.keyCode==36&&e.ctrlKey){$j.datepicker.showFor(this);}},_doKeyPress:function(e){var inst=$j.datepicker._getInst(this._calId);var chr=String.fromCharCode(e.charCode==undefined?e.keyCode:e.charCode);return(chr<' '||chr==inst._get('dateFormat').charAt(3)||(chr>='0'&&chr<='9'));},_connectDatepicker:function(target,inst){var input=$j(target);if(this._hasClass(input,this.markerClassName)){return;}
var appendText=inst._get('appendText');if(appendText){input.after('<span class="datepicker_append">'+appendText+'</span>');}
var showOn=inst._get('showOn');if(showOn=='focus'||showOn=='both'){input.focus(this.showFor);}
if(showOn=='button'||showOn=='both'){var buttonText=inst._get('buttonText');var buttonImage=inst._get('buttonImage');var buttonImageOnly=inst._get('buttonImageOnly');var trigger=$j(buttonImageOnly?'<img class="datepicker_trigger" src="'+
buttonImage+'" alt="'+buttonText+'" title="'+buttonText+'"/>':'<button type="button" class="datepicker_trigger">'+(buttonImage!=''?'<img src="'+buttonImage+'" alt="'+buttonText+'" title="'+buttonText+'"/>':buttonText)+'</button>');input.wrap('<span class="datepicker_wrap"></span>').after(trigger);trigger.click(this.showFor);}
input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress);input[0]._calId=inst._id;},_inlineDatepicker:function(target,inst){var input=$j(target);if(this._hasClass(input,this.markerClassName)){return;}
input.addClass(this.markerClassName).append(inst._datepickerDiv);input[0]._calId=inst._id;this._updateDatepicker(inst);inst._datepickerDiv.resize(function(){$j.datepicker._inlineShow(inst);});},_inlineShow:function(inst){var numMonths=inst._get('numberOfMonths');numMonths=(numMonths==null?1:(typeof numMonths=='number'?numMonths:numMonths[1]));inst._datepickerDiv.width(numMonths*$j('.datepicker',inst._datepickerDiv[0]).width());},_hasClass:function(element,className){var classes=element.attr('class');return(classes&&classes.indexOf(className)>-1);},dialogDatepicker:function(dateText,onSelect,settings,pos){var inst=this._dialogInst;if(!inst){inst=this._dialogInst=new DatepickerInstance({},false);this._dialogInput=$j('<input type="text" size="1" style="position: absolute; top: -100px;"/>');this._dialogInput.keydown(this._doKeyDown);$j('body').append(this._dialogInput);this._dialogInput[0]._calId=inst._id;}
extendRemove(inst._settings,settings||{});this._dialogInput.val(dateText);var viewportWidth;var viewportHeight;if(window.innerWidth){viewportWidth=window.innerWidth,viewportHeight=window.innerHeight}
else if(document.documentElement&&document.documentElement.clientWidth&&document.documentElement.clientWidth!=0){viewportWidth=document.documentElement.clientWidth,viewportHeight=document.documentElement.clientHeight}
else{viewportWidth=document.getElementsByTagName('body')[0].clientWidth,viewportHeight=document.getElementsByTagName('body')[0].clientHeight}
this._pos=pos||[(viewportWidth/2)-100,(viewportHeight/2)-150];this._pos[1]=this._pos[1]+
(document.documentElement&&document.documentElement.scrollTop?document.documentElement.scrollTop:document.body.scrollTop);this._dialogInput.css('left',this._pos[0]+'px').css('top',this._pos[1]+'px');inst._settings.onSelect=onSelect;this._inDialog=true;this._datepickerDiv.addClass('datepicker_dialog');this.showFor(this._dialogInput[0]);if($j.blockUI){$j.blockUI(this._datepickerDiv);}
return this;},enableFor:function(inputs){inputs=(inputs.jquery?inputs:$j(inputs));inputs.each(function(){this.disabled=false;$j(this).siblings('button.datepicker_trigger').each(function(){this.disabled=false;});$j(this).siblings('img.datepicker_trigger').css({opacity:'1.0',cursor:''});var $jthis=this;$j.datepicker._disabledInputs=$j.map($j.datepicker._disabledInputs,function(value){return(value==$jthis?null:value);});});return this;},disableFor:function(inputs){inputs=(inputs.jquery?inputs:$j(inputs));inputs.each(function(){this.disabled=true;$j(this).siblings('button.datepicker_trigger').each(function(){this.disabled=true;});$j(this).siblings('img.datepicker_trigger').css({opacity:'0.5',cursor:'default'});var $jthis=this;$j.datepicker._disabledInputs=$j.map($j.datepicker._disabledInputs,function(value){return(value==$jthis?null:value);});$j.datepicker._disabledInputs[$j.datepicker._disabledInputs.length]=this;});return this;},isDisabled:function(input){input=(input.jquery?input[0]:(typeof input=='string'?$j(input)[0]:input));for(var i=0;i<$j.datepicker._disabledInputs.length;i++){if($j.datepicker._disabledInputs[i]==input){return true;}}
return false;},reconfigureFor:function(control,settings){control=(control.jquery?control[0]:(typeof control=='string'?$j(control)[0]:control));var inst=this._getInst(control._calId);if(inst){extendRemove(inst._settings,settings||{});this._updateDatepicker(inst);}
return this;},setDateFor:function(control,date,endDate){control=(control.jquery?control[0]:(typeof control=='string'?$j(control)[0]:control));var inst=this._getInst(control._calId);if(inst){inst._setDate(date,endDate);this._updateDatepicker(inst);}
return this;},getDateFor:function(control){control=(control.jquery?control[0]:(typeof control=='string'?$j(control)[0]:control));var inst=this._getInst(control._calId);return(inst?inst._getDate():null);},showFor:function(control){control=(control.jquery?control[0]:(typeof control=='string'?$j(control)[0]:control));var input=(control.nodeName&&control.nodeName.toLowerCase()=='input'?control:this);if(input.nodeName.toLowerCase()!='input'){input=$j('input',input.parentNode)[0];}
if($j.datepicker._lastInput==input){return;}
if($j.datepicker.isDisabled(input)){return;}
var inst=$j.datepicker._getInst(input._calId);var beforeShow=inst._get('beforeShow');extendRemove(inst._settings,(beforeShow?beforeShow(input):{}));$j.datepicker.hideDatepicker('');$j.datepicker._lastInput=input;inst._setDateFromField(input);if($j.datepicker._inDialog){input.value='';}
if(!$j.datepicker._pos){$j.datepicker._pos=$j.datepicker._findPos(input);$j.datepicker._pos[1]+=input.offsetHeight;}
inst._datepickerDiv.css('position',($j.datepicker._inDialog&&$j.blockUI?'static':'absolute')).css('left',$j.datepicker._pos[0]+'px').css('top',$j.datepicker._pos[1]+'px');$j.datepicker._pos=null;$j.datepicker._showDatepicker(inst);return this;},_showDatepicker:function(id){var inst=this._getInst(id);inst._rangeStart=null;this._updateDatepicker(inst);if(!inst._inline){var speed=inst._get('speed');var postProcess=function(){$j.datepicker._datepickerShowing=true;$j.datepicker._afterShow(inst);};inst._datepickerDiv.show(speed,postProcess);if(speed==''){postProcess();}
if(inst._input[0].type!='hidden'){inst._input[0].focus();}
this._curInst=inst;}},_updateDatepicker:function(inst){inst._datepickerDiv.empty().append(inst._generateDatepicker());if(inst._get('numberOfMonths')!=1){inst._datepickerDiv.addClass('datepicker_multi');}
else{inst._datepickerDiv.removeClass('datepicker_multi');}
if(inst._input&&inst._input[0].type!='hidden'){inst._input[0].focus();}},_afterShow:function(inst){var numMonths=inst._get('numberOfMonths');numMonths=(numMonths==null?1:(typeof numMonths=='number'?numMonths:numMonths[1]));inst._datepickerDiv.width(numMonths*$j('.datepicker',inst._datepickerDiv[0]).width());if($j.browser.msie){$j('#datepicker_cover').css({width:inst._datepickerDiv.width()+4,height:inst._datepickerDiv.height()+4});}
var pos=$j.datepicker._findPos(inst._input[0]);browserWidth=$j(window).width();if(document.documentElement&&(document.documentElement.scrollLeft)){browserX=document.documentElement.scrollLeft;}
else{browserX=document.body.scrollLeft;}
if((inst._datepickerDiv.offset().left+inst._datepickerDiv.width())>(browserWidth+browserX)){inst._datepickerDiv.css('left',(pos[0]+$j(inst._input[0]).width()-inst._datepickerDiv.width())+'px');}
browserHeight=$j(window).height();if(document.documentElement&&(document.documentElement.scrollTop)){browserTopY=document.documentElement.scrollTop;}
else{browserTopY=document.body.scrollTop;}
if((inst._datepickerDiv.offset().top+inst._datepickerDiv.height())>(browserTopY+browserHeight)){inst._datepickerDiv.css('top',(pos[1]-inst._datepickerDiv.height())+'px');}},hideDatepicker:function(speed){var inst=this._curInst;if(!inst){return;}
var rangeSelect=inst._get('rangeSelect');if(rangeSelect&&this._stayOpen){this._selectDate(inst,inst._formatDate(inst._currentDay,inst._currentMonth,inst._currentYear));}
this._stayOpen=false;if(this._datepickerShowing){speed=(speed!=null?speed:inst._get('speed'));inst._datepickerDiv.hide(speed,function(){$j.datepicker._tidyDialog(inst);});if(speed==''){this._tidyDialog(inst);}
this._datepickerShowing=false;this._lastInput=null;inst._settings.prompt=null;if(this._inDialog){this._dialogInput.css('position','absolute').css('left','0px').css('top','-100px');if($j.blockUI){$j.unblockUI();$j('body').append(this._datepickerDiv);}}
this._inDialog=false;}
this._curInst=null;},_tidyDialog:function(inst){inst._datepickerDiv.removeClass('datepicker_dialog');$j('.datepicker_prompt',inst._datepickerDiv).remove();},_checkExternalClick:function(event){if(!$j.datepicker._curInst){return;}
var target=$j(event.target);if((target.parents("#datepicker_div").length==0)&&(target.attr('class')!='datepicker_trigger')&&$j.datepicker._datepickerShowing&&!($j.datepicker._inDialog&&$j.blockUI)){$j.datepicker.hideDatepicker('');}},_adjustDate:function(id,offset,period){var inst=this._getInst(id);inst._adjustDate(offset,period);this._updateDatepicker(inst);},_gotoToday:function(id){var date=new Date();var inst=this._getInst(id);inst._selectedDay=date.getDate();inst._selectedMonth=date.getMonth();inst._selectedYear=date.getFullYear();this._adjustDate(inst);},_selectMonthYear:function(id,select,period){var inst=this._getInst(id);inst._selectingMonthYear=false;inst[period=='M'?'_selectedMonth':'_selectedYear']=select.options[select.selectedIndex].value-0;this._adjustDate(inst);},_clickMonthYear:function(id){var inst=this._getInst(id);if(inst._input&&inst._selectingMonthYear&&!$j.browser.msie){inst._input[0].focus();}
inst._selectingMonthYear=!inst._selectingMonthYear;},_changeFirstDay:function(id,a){var inst=this._getInst(id);var dayNames=inst._get('dayNames');var value=a.firstChild.nodeValue;for(var i=0;i<7;i++){if(dayNames[i]==value){inst._settings.firstDay=i;break;}}
this._updateDatepicker(inst);},_selectDay:function(id,month,year,td){if(this._hasClass($j(td),'datepicker_unselectable')){return;}
var inst=this._getInst(id);var rangeSelect=inst._get('rangeSelect');if(rangeSelect){if(!this._stayOpen){$j('.datepicker td').removeClass('datepicker_currentDay');$j(td).addClass('datepicker_currentDay');}
this._stayOpen=!this._stayOpen;}
inst._currentDay=$j('a',td).html();inst._currentMonth=month;inst._currentYear=year;this._selectDate(id,inst._formatDate(inst._currentDay,inst._currentMonth,inst._currentYear));if(this._stayOpen){inst._endDay=inst._endMonth=inst._endYear=null;inst._rangeStart=new Date(inst._currentYear,inst._currentMonth,inst._currentDay);this._updateDatepicker(inst);}
else if(rangeSelect){if(inst._inline){inst._endDay=inst._currentDay;inst._endMonth=inst._currentMonth;inst._endYear=inst._currentYear;inst._selectedDay=inst._currentDay=inst._rangeStart.getDate();inst._selectedMonth=inst._currentMonth=inst._rangeStart.getMonth();inst._selectedYear=inst._currentYear=inst._rangeStart.getFullYear();inst._rangeStart=null;this._updateDatepicker(inst);}
else{inst._rangeStart=null;}}},_clearDate:function(id){var inst=this._getInst(id);this._stayOpen=false;inst._rangeStart=null;this._selectDate(inst,'');},_selectDate:function(id,dateStr){var inst=this._getInst(id);dateStr=(dateStr!=null?dateStr:inst._formatDate());if(inst._rangeStart){dateStr=inst._formatDate(inst._rangeStart)+inst._get('rangeSeparator')+dateStr;}
if(inst._input){inst._input.val(dateStr);}
var onSelect=inst._get('onSelect');if(onSelect){onSelect(dateStr,inst);}
else{inst._input.trigger('change');}
if(inst._inline){this._updateDatepicker(inst);}
else{if(!this._stayOpen){this.hideDatepicker(inst._get('speed'));}}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),''];},_findPos:function(obj){while(obj&&(obj.type=='hidden'||obj.nodeType!=1)){obj=obj.nextSibling;}
var curleft=curtop=0;if(obj&&obj.offsetParent){curleft=obj.offsetLeft;curtop=obj.offsetTop;while(obj=obj.offsetParent){var origcurleft=curleft;curleft+=obj.offsetLeft;if(curleft<0){curleft=origcurleft;}
curtop+=obj.offsetTop;}}
return[curleft,curtop];}});function DatepickerInstance(settings,inline){this._id=$j.datepicker._register(this);this._selectedDay=0;this._selectedMonth=0;this._selectedYear=0;this._input=null;this._inline=inline;this._datepickerDiv=(!inline?$j.datepicker._datepickerDiv:$j('<div id="datepicker_div_'+this._id+'" class="datepicker_inline"></div>'));this._settings=extendRemove({},settings||{});if(inline){this._setDate(this._getDefaultDate());}}
$j.extend(DatepickerInstance.prototype,{_get:function(name){return(this._settings[name]!=null?this._settings[name]:$j.datepicker._defaults[name]);},_setDateFromField:function(input){this._input=$j(input);var dateFormat=this._get('dateFormat');var currentDate=this._input.val().split(dateFormat.charAt(3));this._endDay=this._endMonth=this._endYear=null;var shortYearCutoff=this._get('shortYearCutoff');shortYearCutoff=(typeof shortYearCutoff!='string'?shortYearCutoff:new Date().getFullYear()%100+parseInt(shortYearCutoff,10));var checkYear=function(year){if(year>=100){return year;}
var fullYear=new Date().getFullYear();return fullYear-(fullYear%100)+year+(year<=shortYearCutoff?0:-100);};if(currentDate.length==3){this._currentDay=parseInt(currentDate[dateFormat.indexOf('D')],10);this._currentMonth=parseInt(currentDate[dateFormat.indexOf('M')],10)-1;this._currentYear=checkYear(parseInt(currentDate[dateFormat.indexOf('Y')],10));}
else if(currentDate.length==5){currentDateArray=this._input.val().split(this._get('rangeSeparator'));currentDate=currentDateArray[0].split(dateFormat.charAt(3));this._currentDay=parseInt(currentDate[dateFormat.indexOf('D')],10);this._currentMonth=parseInt(currentDate[dateFormat.indexOf('M')],10)-1;this._currentYear=checkYear(parseInt(currentDate[dateFormat.indexOf('Y')],10));currentDate=currentDateArray[1].split(dateFormat.charAt(3));this._endDay=parseInt(currentDate[dateFormat.indexOf('D')],10);this._endMonth=parseInt(currentDate[dateFormat.indexOf('M')],10)-1;this._endYear=checkYear(parseInt(currentDate[dateFormat.indexOf('Y')],10));}
else{var date=this._getDefaultDate();this._currentDay=date.getDate();this._currentMonth=date.getMonth();this._currentYear=date.getFullYear();}
this._selectedDay=this._currentDay;this._selectedMonth=this._currentMonth;this._selectedYear=this._currentYear;this._adjustDate();},_getDefaultDate:function(){var offsetDate=function(offset){var date=new Date();date.setDate(date.getDate()+offset);return date;};var defaultDate=this._get('defaultDate');return(defaultDate==null?new Date():(typeof defaultDate=='number'?offsetDate(defaultDate):defaultDate));},_setDate:function(date,endDate){this._selectedDay=this._currentDay=date.getDate();this._selectedMonth=this._currentMonth=date.getMonth();this._selectedYear=this._currentYear=date.getFullYear();if(this._get('rangeSelect')){if(endDate){this._endDay=endDate.getDate();this._endMonth=endDate.getMonth();this._endYear=endDate.getFullYear();}
else{this._endDay=this._currentDay;this._endMonth=this._currentMonth;this._endYear=this._currentYear;}}
this._adjustDate();},_getDate:function(){var startDate=new Date(this._currentYear,this._currentMonth,this._currentDay);if(this._get('rangeSelect')){return[startDate,new Date(this._endYear,this._endMonth,this._endDay)];}
else{return startDate;}},_generateDatepicker:function(){var today=new Date();today=new Date(today.getFullYear(),today.getMonth(),today.getDate());var controls='<div class="datepicker_control">'+'<div class="datepicker_clear"><a onclick="jQuery.datepicker._clearDate('+this._id+');">'+
this._get('clearText')+'</a></div>'+'<div class="datepicker_close"><a onclick="jQuery.datepicker.hideDatepicker();">'+
this._get('closeText')+'</a></div></div>';var prompt=this._get('prompt');var closeAtTop=this._get('closeAtTop');var hideIfNoPrevNext=this._get('hideIfNoPrevNext');var numMonths=this._get('numberOfMonths');var stepMonths=this._get('stepMonths');var isMultiMonth=(numMonths!=1);numMonths=(numMonths==null?[1,1]:(typeof numMonths=='number'?[1,numMonths]:numMonths));var html=(prompt?'<div class="datepicker_prompt">'+prompt+'</div>':'')+
(closeAtTop&&!this._inline?controls:'')+'<div class="datepicker_links"><div class="datepicker_prev">'+
(this._canAdjustMonth(-1)?'<a onclick="jQuery.datepicker._adjustDate('+this._id+', -'+stepMonths+', \'M\');">'+this._get('prevText')+'</a>':(hideIfNoPrevNext?'':'<label>'+this._get('prevText')+'</label>'))+'</div>'+
(this._isInRange(today)?'<div class="datepicker_current"><a '+'onclick="jQuery.datepicker._gotoToday('+this._id+');">'+this._get('currentText')+'</a></div>':'')+'<div class="datepicker_next">'+
(this._canAdjustMonth(+1)?'<a onclick="jQuery.datepicker._adjustDate('+this._id+', +'+stepMonths+', \'M\');">'+this._get('nextText')+'</a>':(hideIfNoPrevNext?'':'<label>'+this._get('nextText')+'</label>'))+'</div></div>';var minDate=this._getMinDate();var maxDate=this._get('maxDate');var drawMonth=this._selectedMonth;var drawYear=this._selectedYear;for(var row=0;row<numMonths[0];row++){for(var col=0;col<numMonths[1];col++){var selectedDate=new Date(drawYear,drawMonth,this._selectedDay);html+='<div class="datepicker_oneMonth'+(col==0?' datepicker_newRow':'')+'">'+
this._generateMonthYearHeader(drawMonth,drawYear,minDate,maxDate,selectedDate,row>0||col>0)+'<table class="datepicker" cellpadding="0" cellspacing="0"><thead>'+'<tr class="datepicker_titleRow">';var firstDay=this._get('firstDay');var changeFirstDay=this._get('changeFirstDay');var dayNames=this._get('dayNames');for(var dow=0;dow<7;dow++){html+='<td>'+(!changeFirstDay?'':'<a onclick="jQuery.datepicker._changeFirstDay('+this._id+', this);">')+
dayNames[(dow+firstDay)%7]+(changeFirstDay?'</a>':'')+'</td>';}
html+='</tr></thead><tbody>';var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);this._selectedDay=Math.min(this._selectedDay,daysInMonth);var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var currentDate=new Date(this._currentYear,this._currentMonth,this._currentDay);var endDate=this._endDay?new Date(this._endYear,this._endMonth,this._endDay):currentDate;var printDate=new Date(drawYear,drawMonth,1-leadDays);var numRows=(isMultiMonth?6:Math.ceil((leadDays+daysInMonth)/7));var beforeShowDay=this._get('beforeShowDay');var showOtherMonths=this._get('showOtherMonths');var count=0;for(var dRow=0;dRow<numRows;dRow++){html+='<tr class="datepicker_daysRow">';for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay(printDate):[true,'']);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=otherMonth||!daySettings[0]||(minDate&&printDate<minDate)||(maxDate&&printDate>maxDate);html+='<td class="datepicker_daysCell'+
((dow+firstDay+6)%7>=5?' datepicker_weekEndCell':'')+
(otherMonth?' datepicker_otherMonth':'')+
(printDate.getTime()==selectedDate.getTime()&&drawMonth==this._selectedMonth?' datepicker_daysCellOver':'')+
(unselectable?' datepicker_unselectable':'')+
(otherMonth&&!showOtherMonths?'':' '+daySettings[1]+
(printDate.getTime()>=currentDate.getTime()&&printDate.getTime()<=endDate.getTime()?' datepicker_currentDay':(printDate.getTime()==today.getTime()?' datepicker_today':'')))+'"'+
(unselectable?'':' onmouseover="$j(this).addClass(\'datepicker_daysCellOver\');"'+' onmouseout="$j(this).removeClass(\'datepicker_daysCellOver\');"'+' onclick="jQuery.datepicker._selectDay('+this._id+','+drawMonth+','+drawYear+', this);"')+'>'+
(otherMonth?(showOtherMonths?printDate.getDate():'&nbsp;'):(unselectable?printDate.getDate():'<a>'+printDate.getDate()+'</a>'))+'</td>';printDate.setDate(printDate.getDate()+1);}
html+='</tr>';}
drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++;}
html+='</tbody></table></div>';}}
html+=(!closeAtTop&&!this._inline?controls:'')+'<div style="clear: both;"></div>'+(!$j.browser.msie?'':'<!--[if lte IE 6.5]><iframe src="javascript:false;" class="datepicker_cover"></iframe><![endif]-->');return html;},_generateMonthYearHeader:function(drawMonth,drawYear,minDate,maxDate,selectedDate,secondary){minDate=(this._rangeStart&&minDate&&selectedDate<minDate?selectedDate:minDate);var html='<div class="datepicker_header">';var monthNames=this._get('monthNames');if(secondary||!this._get('changeMonth')){html+=monthNames[drawMonth]+'&nbsp;';}
else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);html+='<select class="datepicker_newMonth" '+'onchange="jQuery.datepicker._selectMonthYear('+this._id+', this, \'M\');" '+'onclick="jQuery.datepicker._clickMonthYear('+this._id+');">';for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){html+='<option value="'+month+'"'+
(month==drawMonth?' selected="selected"':'')+'>'+monthNames[month]+'</option>';}}
html+='</select>';}
if(secondary||!this._get('changeYear')){html+=drawYear;}
else{var years=this._get('yearRange').split(':');var year=0;var endYear=0;if(years.length!=2){year=drawYear-10;endYear=drawYear+10;}
else if(years[0].charAt(0)=='+'||years[0].charAt(0)=='-'){year=drawYear+parseInt(years[0],10);endYear=drawYear+parseInt(years[1],10);}
else{year=parseInt(years[0],10);endYear=parseInt(years[1],10);}
year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);html+='<select class="datepicker_newYear" '+'onchange="jQuery.datepicker._selectMonthYear('+this._id+', this, \'Y\');" '+'onclick="jQuery.datepicker._clickMonthYear('+this._id+');">';for(;year<=endYear;year++){html+='<option value="'+year+'"'+
(year==drawYear?' selected="selected"':'')+'>'+year+'</option>';}
html+='</select>';}
html+='</div>';return html;},_adjustDate:function(offset,period){var year=this._selectedYear+(period=='Y'?offset:0);var month=this._selectedMonth+(period=='M'?offset:0);var day=Math.min(this._selectedDay,this._getDaysInMonth(year,month))+
(period=='D'?offset:0);var date=new Date(year,month,day);var minDate=this._getMinDate();var maxDate=this._get('maxDate');date=(minDate&&date<minDate?minDate:date);date=(maxDate&&date>maxDate?maxDate:date);this._selectedDay=date.getDate();this._selectedMonth=date.getMonth();this._selectedYear=date.getFullYear();},_getMinDate:function(){return this._get('minDate')||this._rangeStart;},_getDaysInMonth:function(year,month){return 32-new Date(year,month,32).getDate();},_getFirstDayOfMonth:function(year,month){return new Date(year,month,1).getDay();},_canAdjustMonth:function(offset){var date=new Date(this._selectedYear,this._selectedMonth+offset,1);if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()));}
return this._isInRange(date);},_isInRange:function(date){var newMinDate=(!this._rangeStart?null:new Date(this._selectedYear,this._selectedMonth,this._selectedDay));newMinDate=(newMinDate&&this._rangeStart<newMinDate?this._rangeStart:newMinDate);var minDate=newMinDate||this._get('minDate');var maxDate=this._get('maxDate');return((!minDate||date>=minDate)&&(!maxDate||date<=maxDate));},_formatDate:function(day,month,year){if(!day){day=this._currentDay=this._selectedDay;month=this._currentMonth=this._selectedMonth;year=this._currentYear=this._selectedYear;}
else if(typeof day=='object'){year=day.getFullYear();month=day.getMonth();day=day.getDate();}
month++;year=(this._get('useShortYear')?year%100:year);var dateFormat=this._get('dateFormat');var dateString='';for(var i=0;i<3;i++){dateString+=dateFormat.charAt(3)+
(dateFormat.charAt(i)=='D'?(day<10?'0':'')+day:(dateFormat.charAt(i)=='M'?(month<10?'0':'')+month:(dateFormat.charAt(i)=='Y'?(year<10?'0':'')+year:'?')));}
return dateString.substring(dateFormat.charAt(3)?1:0);}});function extendRemove(target,props){$j.extend(target,props);for(var name in props){if(props[name]==null){target[name]=null;}}
return target;}
$j.fn.datepicker=function(settings){return this.each(function(){var inlineSettings=null;for(attrName in $j.datepicker._defaults){var attrValue=this.getAttribute('date:'+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue);}
catch(err){inlineSettings[attrName]=attrValue;}}}
var nodeName=this.nodeName.toLowerCase();if(nodeName=='input'){var instSettings=(inlineSettings?$j.extend($j.extend({},settings||{}),inlineSettings||{}):settings);var inst=(inst&&!inlineSettings?inst:new DatepickerInstance(instSettings,false));$j.datepicker._connectDatepicker(this,inst);}
else if(nodeName=='div'||nodeName=='span'){var instSettings=$j.extend($j.extend({},settings||{}),inlineSettings||{});var inst=new DatepickerInstance(instSettings,true);$j.datepicker._inlineDatepicker(this,inst);}});};$j(document).ready(function(){$j.datepicker=new Datepicker();$j(document.body).append($j.datepicker._datepickerDiv).mousedown($j.datepicker._checkExternalClick);});})(jQuery);



//function to validate quote form1
function validate_quote()
{
	var error_message = document.getElementById('error_message');

	var themepath, email, triptype, passengers, depcity, descity, depdate, retdate,code;

    themepath = document.getElementById('themepath').value;
    email = document.getElementById('email');
    triptype = document.getElementById('triptype');
    passengers = document.getElementById('passengers');
    depcity = document.getElementById('depcity');
    descity = document.getElementById('descity');
    depdate = document.getElementById('depdate');
    retdate = document.getElementById('retdate');
    code = document.getElementById('code');

    var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;


    if (trim(triptype.value) == '')   {
      error_message.innerHTML = 'Select Trip Type.';
      triptype.focus ();
      return false;
    }
    if (trim(passengers.value) == '')   {
      error_message.innerHTML = 'Select Passengers.';
      passengers.focus ();
      return false;
    }
    if (trim(depcity.value) == '')   {
      error_message.innerHTML = 'Enter Departure City or Airport Code.';
      depcity.focus ();
      return false;
    }
    if (trim(descity.value) == '')   {
      error_message.innerHTML = 'Enter Destination City or Airport Code.';
      descity.focus ();
      return false;
    }
    if (trim(depcity.value) == trim(descity.value)){
      error_message.innerHTML = 'Departure City and Destination City Are Same.';
      return false;
    }
    if (trim(depdate.value) == '')   {
      error_message.innerHTML = 'Select Departure Date.';
      depdate.focus ();
      return false;
    }
    if (trim(triptype.value) == 'Round Trip'){
      if (trim(retdate.value) == '')   {
        error_message.innerHTML = 'Select Return Date.';
        retdate.focus ();
        return false;
      }
    }

    if(trim(depdate.value)!="" && trim(retdate.value)!=""){
        var depdate_arr = depdate.value.split('-');
        var retdate_arr = retdate.value.split('-');

        /*if((retdate_arr[0] < depdate_arr[0]) || (retdate_arr[1] < depdate_arr[1]) || (retdate_arr[2] < depdate_arr[2])){
           error_message.innerHTML = 'Return Date should be equal or greater than Departure Date.';
           return false;
        }*/

        if(retdate_arr[2] == depdate_arr[2]){
           if(retdate_arr[0] == depdate_arr[0]){
                if(retdate_arr[1] < depdate_arr[1]){
                    error_message.innerHTML = 'Return Date should be equal or greater than Departure Date.';
                    return false;
                }
           }
        }
    }
    if (trim(email.value) == '')   {
      error_message.innerHTML = 'Enter Email Address.';
      email.focus ();
      return false;
    }
    else if (!email.value.match(emailRegEx)) {
      error_message.innerHTML = 'Enter Valid Email Address.';
      email.focus ();
      return false;
    }

    if (trim(code.value) == '')   {
      error_message.innerHTML = 'Please enter code.';
      code.focus ();
      return false;
    }

    var em = document.getElementById('email').value;
    var dp = document.getElementById('depcity').value;
    var ds = document.getElementById('descity').value;
    var dd = document.getElementById('depdate').value;
    var rd = document.getElementById('retdate').value;
    var code = document.getElementById('code').value;

    /*document.getElementById('email').value = "";
    document.getElementById('depcity').value = "";
    document.getElementById('descity').value = "";
    document.getElementById('depdate').value = "";
    document.getElementById('retdate').value = "";*/

	$j.ajax(
	{
		type:	"POST",
		url	:	themepath+"/ajax/ajax.sendquote.php",
        data:	"step=step1&email="+em+'&triptype='+triptype.value+'&passengers='+passengers.value+'&depcity='+dp+'&descity='+ds+'&depdate='+dd+'&retdate='+rd+'&code='+code,
		success: function(msg)
		{
			//document.getElementById('error_message').style.color = 'green';
			//document.getElementById('error_message').innerHTML = msg; quote_step_2
			//var hide_form	=	setTimeout("fun_hide_form()" ,2000);
            if(msg != 'Error')
            {
                document.getElementById('quote_step_1').style.display = "none";
                document.getElementById('quote_step_2').style.display = "block";
                document.getElementById('email2').value = em;
            }
            else
            {
                document.getElementById('quote_step_1').style.display = "block";
                document.getElementById('quote_step_2').style.display = "none";
                document.getElementById('email').value = em;
                document.getElementById('depcity').value=dp;
                document.getElementById('descity').value=ds;
                document.getElementById('depdate').value=dd;
                document.getElementById('retdate').value=rd;
                document.getElementById('error_message').innerHTML='Please enter valid code.';
            }

		}
	});

}

//function to validate quote form1
function validate_quote_2()
{
	var error_message = document.getElementById('error_message2');

	var themepath, fname, lname, email2, phone, cname, charter, comments;

    themepath = document.getElementById('themepath').value;
    fname = document.getElementById('fname');
    lname = document.getElementById('lname');
    email2 = document.getElementById('email2');
    phone = document.getElementById('phone');
    //cname = document.getElementById('cname');
    //charter = document.getElementById('charter');
    comments = document.getElementById('comments');

    var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;


    if (trim(fname.value) == '')   {
      error_message.innerHTML = 'Enter First Name.';
      fname.focus ();
      return false;
    }
    if (trim(lname.value) == '')   {
      error_message.innerHTML = 'Enter Last Name.';
      lname.focus ();
      return false;
    }
    if (trim(email2.value) == '')   {
      error_message.innerHTML = 'Enter Email Address.';
      email2.focus ();
      return false;
    }
    else if (!email2.value.match(emailRegEx)) {
      error_message.innerHTML = 'Enter Valid Email Address.';
      email2.focus ();
      return false;
    }
    if (trim(phone.value) == '')   {
      error_message.innerHTML = 'Enter Telephone.';
      phone.focus ();
      return false;
    }

    var fn = document.getElementById('fname').value;
    var ln = document.getElementById('lname').value;
    var em2 = document.getElementById('email2').value;
    var ph = document.getElementById('phone').value;
    //var cn = document.getElementById('cname').value;
    var cm = document.getElementById('comments').value;

    $j.ajax(
	{
		type:	"POST",
		url	:	themepath+"/ajax/ajax.sendquote.php",
        data:	"step=step2&fname="+fn+'&lname='+ln+'&email2='+em2+'&phone='+ph+'&comments='+cm,
		success: function(msg)
		{
            var msg_arr = msg.split("@");
            if(msg_arr[0] == "Thank You"){
                document.getElementById('fname').value = "";
                document.getElementById('lname').value = "";
                document.getElementById('email2').value = "";
                document.getElementById('phone').value = "";
                //document.getElementById('cname').value = "";
                document.getElementById('comments').value = "";

                document.getElementById('quote_step_2').style.display = "none";
                document.getElementById('quote_step_3').style.display = "block";
                document.getElementById('done').innerHTML = msg_arr[1];
                var hide_form =	setTimeout("fun_hide_form()" ,3000);
            }
            else if(msg_arr[0] == "Error while sending mail."){
                document.getElementById('error_message2').innerHTML = msg_arr[0];
            }
		}
	});

}

function fun_hide_form()
{
	$j.aqs.Base.UI.Effects.toggleUIC();
	window.location.reload();
}

//function to validate quote form1
function validate_quote_left()
{
	var error_message = document.getElementById('lerror_message');

	var themepath, email, triptype, passengers, depcity, descity, depdate, retdate,code;

    themepath = document.getElementById('lthemepath').value;
    email = document.getElementById('lemail');
    triptype = document.getElementById('ltriptype');
    passengers = document.getElementById('lpassengers');
    depcity = document.getElementById('ldepcity');
    descity = document.getElementById('ldescity');
    depdate = document.getElementById('ldepdate');
    retdate = document.getElementById('lretdate');
    code = document.getElementById('lcode');

    var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;


    if (trim(triptype.value) == '')   {
      error_message.innerHTML = 'Select Trip Type.';
      triptype.focus ();
      return false;
    }
    if (trim(passengers.value) == '')   {
      error_message.innerHTML = 'Select Passengers.';
      passengers.focus ();
      return false;
    }
    if (trim(depcity.value) == '')   {
      error_message.innerHTML = 'Enter Departure City or <br/>Airport Code.';
      depcity.focus ();
      return false;
    }
    if (trim(descity.value) == '')   {
      error_message.innerHTML = 'Enter Destination City or <br/>Airport Code.';
      descity.focus ();
      return false;
    }
    if (trim(depcity.value) == trim(descity.value)){
      error_message.innerHTML = 'Departure City and Destination City Are Same.';
      return false;
    }
    if (trim(depdate.value) == '')   {
      error_message.innerHTML = 'Select Departure Date.';
      depdate.focus ();
      return false;
    }
    if (trim(triptype.value) == 'Round Trip'){
      if (trim(retdate.value) == '')   {
        error_message.innerHTML = 'Select Return Date.';
        retdate.focus ();
        return false;
      }
    }

    if(trim(depdate.value)!="" && trim(retdate.value)!=""){
        var depdate_arr = depdate.value.split('-');
        var retdate_arr = retdate.value.split('-');

        /*if((retdate_arr[0] < depdate_arr[0]) || (retdate_arr[1] < depdate_arr[1]) || (retdate_arr[2] < depdate_arr[2])){
           error_message.innerHTML = 'Return Date should be equal or greater than Departure Date.';
           return false;
        }*/

        if(retdate_arr[2] == depdate_arr[2]){
           if(retdate_arr[0] == depdate_arr[0]){
                if(retdate_arr[1] < depdate_arr[1]){
                    error_message.innerHTML = 'Return Date should be equal or greater than Departure Date.';
                    return false;
                }
           }
        }
    }
    if (trim(email.value) == '')   {
      error_message.innerHTML = 'Enter Email Address.';
      email.focus ();
      return false;
    }
    else if (!email.value.match(emailRegEx)) {
      error_message.innerHTML = 'Enter Valid Email Address.';
      email.focus ();
      return false;
    }

    if (trim(code.value) == '')   {
      error_message.innerHTML = 'Please enter code.';
      code.focus ();
      return false;
    }

    var em = document.getElementById('lemail').value;
    var dp = document.getElementById('ldepcity').value;
    var ds = document.getElementById('ldescity').value;
    var dd = document.getElementById('ldepdate').value;
    var rd = document.getElementById('lretdate').value;
    var code = document.getElementById('lcode').value;

    /*document.getElementById('email').value = "";
    document.getElementById('depcity').value = "";
    document.getElementById('descity').value = "";
    document.getElementById('depdate').value = "";
    document.getElementById('retdate').value = "";*/

	$j.ajax(
	{
		type:	"POST",
		url	:	themepath+"/ajax/ajax.sendquote.php",
        data:	"step=step1&email="+em+'&triptype='+triptype.value+'&passengers='+passengers.value+'&depcity='+dp+'&descity='+ds+'&depdate='+dd+'&retdate='+rd+'&code='+code,
		success: function(msg)
		{
			//document.getElementById('error_message').style.color = 'green';
			//document.getElementById('error_message').innerHTML = msg; quote_step_2
			//var hide_form	=	setTimeout("fun_hide_form()" ,2000);
            if(msg != 'Error')
            {
                document.getElementById('lquote_step_1').style.display = "none";
                document.getElementById('lquote_step_2').style.display = "block";
                document.getElementById('lemail2').value = em;
            }
            else
            {
                document.getElementById('lquote_step_1').style.display = "block";
                document.getElementById('lquote_step_2').style.display = "none";
                document.getElementById('lemail').value = em;
                document.getElementById('ldepcity').value=dp;
                document.getElementById('ldescity').value=ds;
                document.getElementById('ldepdate').value=dd;
                document.getElementById('lretdate').value=rd;
                document.getElementById('lerror_message').innerHTML='Please enter valid code.';
            }

		}
	});

}

//function to validate quote form1
function validate_quote_2_left()
{
	var error_message = document.getElementById('lerror_message2');

	var themepath, fname, lname, email2, phone, cname, charter, comments;

    themepath = document.getElementById('lthemepath').value;
    fname = document.getElementById('lfname');
    lname = document.getElementById('llname');
    email2 = document.getElementById('lemail2');
    phone = document.getElementById('lphone');
    //cname = document.getElementById('cname');
    //charter = document.getElementById('charter');
    comments = document.getElementById('lcomments');

    var emailRegEx = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;


    if (trim(fname.value) == '')   {
      error_message.innerHTML = 'Enter First Name.';
      fname.focus ();
      return false;
    }
    if (trim(lname.value) == '')   {
      error_message.innerHTML = 'Enter Last Name.';
      lname.focus ();
      return false;
    }
    if (trim(email2.value) == '')   {
      error_message.innerHTML = 'Enter Email Address.';
      email2.focus ();
      return false;
    }
    else if (!email2.value.match(emailRegEx)) {
      error_message.innerHTML = 'Enter Valid Email Address.';
      email2.focus ();
      return false;
    }
    if (trim(phone.value) == '')   {
      error_message.innerHTML = 'Enter Telephone.';
      phone.focus ();
      return false;
    }

    var fn = document.getElementById('lfname').value;
    var ln = document.getElementById('llname').value;
    var em2 = document.getElementById('lemail2').value;
    var ph = document.getElementById('lphone').value;
    //var cn = document.getElementById('cname').value;
    var cm = document.getElementById('lcomments').value;

    $j.ajax(
	{
		type:	"POST",
		url	:	themepath+"/ajax/ajax.sendquote.php",
        data:	"step=step2&fname="+fn+'&lname='+ln+'&email2='+em2+'&phone='+ph+'&comments='+cm,
		success: function(msg)
		{
            var msg_arr = msg.split("@");
            if(msg_arr[0] == "Thank You"){
                document.getElementById('lfname').value = "";
                document.getElementById('llname').value = "";
                document.getElementById('lemail2').value = "";
                document.getElementById('lphone').value = "";
                //document.getElementById('cname').value = "";
                document.getElementById('lcomments').value = "";

                document.getElementById('lquote_step_2').style.display = "none";
                document.getElementById('lquote_step_3').style.display = "block";
                document.getElementById('ldone').innerHTML = msg_arr[1];
                setTimeout("location.reload()", 3000);
            }
            else if(msg_arr[0] == "Error while sending mail."){
                document.getElementById('lerror_message2').innerHTML = msg_arr[0];
            }
		}
	});

}

function trim(str)
{ // trims input values
    return str.replace(/^\s+|\s+$/g,'');
}