/* ---------- js/global.js ---------- */

function send_msg(){var errors=new Array();var error_msg="The following errors have been detected:\n----------------------------------------\n";if($('name').value==''||$('name').value==' '){errors.push('Please fill in your name!');}
if($('email').value==''||$('email').value==' '){errors.push('Please fill in your email!');}
if($('message').value==''||$('message').value==' '){errors.push('Please send me a message!');}
if(errors.length>0){for(var i=0;i<errors.length;i++){error_msg+=(i+1)+". "+errors[i]+"\n";}
error_msg+="----------------------------------------\nPlease fix and re-submit.";alert(error_msg);}else{var ajax_script='http://www.dalyvisions.com/ajax/send_msg.php';var params='email='+encodeURIComponent($('email').value)+'&name='+encodeURIComponent($('name').value)+'&message='+encodeURIComponent($('message').value)+'&doit=y';var opts={method:'post',parameters:params,onSuccess:function(resp){alert(resp.responseText);$('contact_form').innerHTML='<p class="msg">Thanks for your inquiry into dalyVisions!</p>';},onFailure:function(){alert('Something went wrong...');}};new Ajax.Request(ajax_script,opts);}}
var curr_picts=null;function showPicts(picts){if(curr_picts!=null){new Effect.BlindUp(curr_picts);}
new Effect.BlindDown(picts);curr_picts=picts;}
function hidePicts(picts){new Effect.BlindUp(picts);curr_picts=null;}
function focusField(id,str){var val=$(id).value;if(val==str){$(id).value='';}}
function blurField(id,str){var val=$(id).value;if(val==''){$(id).value=str;}}
function FAQToggleAnswer(question){var answers=question.getElementsByTagName('ul');if(answers[0]){if(answers[0].style.display!='block'){answers[0].style.display='block';}else{answers[0].style.display='none';}}}
function siteSearch(on_submit){var errors=[];var error_srting='';var form_el=$('siteSearch_form');var search_phrase=$('siteSearch_phrase').value;if(search_phrase==''||search_phrase=='-search-'){errors.push('Search phrase was left empty.');}
if(errors.length>0){error_srting='The following errors have been detected:'+"\n\n";for(var i=0;i<errors.length;i++){error_srting+=(i+1)+'. '+errors[i]+"\n";}
error_srting+="\n"+'Please fix these errors and re-submit the form.';alert(error_srting);if(on_submit){return false;}}else{if(on_submit){return true;}else{form_el.submit();}}}
function joinEmail(on_submit){var errors=[];var error_srting='';var form_el=$('joinEmail_form');if($('join_email').value==''){errors.push('Please enter your email address.');}
if(errors.length>0){error_srting='The following errors have been detected:'+"\n\n";for(var i=0;i<errors.length;i++){error_srting+=(i+1)+'. '+errors[i]+"\n";}
error_srting+="\n"+'Please fix these errors and re-submit the form.';alert(error_srting);if(on_submit){return false;}}else{if(on_submit){return true;}else{form_el.submit();}}}
function featured(id,state,url){switch(state){case'over':$(id).addClassName('featuredItem_hover');break;case'out':$(id).removeClassName('featuredItem_hover');break;case'click':window.location=url;break;}}

