/*-................................................................................-*/
 // function for clock
 //clok = document.createElement('img');
 //clok.src = './images/hour.gif';
 //Element.setStyle(clok,{zIndex:1000,position:'absolute',top:'55px',left:'892px',display:'block'});
 //document.body.appendChild(clok);
 //setInterval("runclock()",1);
 //var abspos = 55;
 //function runclock() { 
   //new Effect.Move(clok,{ x: 0, y: abspos-1,mode:'relative'}); 
 //}
 
/*-................................................................................-*/
// global
// attach mouse over in the whole document
// if mouseover element is the spn logo then show the popup options
// onmouseout hide the options
/*if (document.addEventListener)
   document.addEventListener('mouseover', MouseOutExe,false);
else
   document.attachEvent('onmouseover', MouseOutExe);
function MouseOutExe(e) {
  e = Event.element(e);
  if ( (e.id == 'spn_logo_options') || (e.parentNode.id == 'spn_logo_poped') || (e.id == 'spn_logo_poped')  ) {
	 if (!$('spn_logo_poped') &&  !$('sendtofrnd') ) {
	   
	   // get the gadgets id
	   var urll = location.href.split('=');
	   gid = urll[1];
	   
	   // get the spn logo position
	   var spnpos = Position.cumulativeOffset($('spn_logo_options'));
	   p = document.createElement('div');
	   p.id = 'spn_logo_poped';
	   p.className = 'spn_logo_class';
	   Element.setStyle(p,{zIndex:1000,position:'absolute',width:'100px',height:'45px',top:spnpos[1]-45+'px',left:spnpos[0]-38+'px',display:'none',border:'1px solid #2B8CB4',backgroundColor:'#FEFEFE'});
	   p.innerHTML = '<div id="more_gadgets" style="border:1px solid #4B6971;cursor:pointer;text-align:left;padding-left:2px;color:#2B8CB4;" onmouseover="javascript:$(\'more_gadgets\').style.backgroundColor=\'#98DEFD\';" onmouseout="javascript:$(\'more_gadgets\').style.backgroundColor=\'#FEFEFE\';" onclick="javascript:get_gadgets('+gid+'); return false;"><img src="http://www.smartwebgadgets.com/gad_image/circle.gif" border="0" >&nbsp;Add to My Site</div>'; 
	   p.innerHTML += '<div id="sendtofriend" style="border:1px solid #4B6971;cursor:pointer;text-align:left;padding-left:2px;;color:#2B8CB4;" onclick="javascript:send_to_frnd('+gid+'); return false;" onmouseover="javascript:$(\'sendtofriend\').style.backgroundColor=\'#98DEFD\';" onmouseout="javascript:$(\'sendtofriend\').style.backgroundColor=\'#FEFEFE\';"><img src="http://www.smartwebgadgets.com/gad_image/sndfrnd.gif" border="0" >&nbsp;Send to Friend</div>'; 
	   p.innerHTML += '<div id="help" style="border:1px solid #4B6971;cursor:pointer;text-align:left;padding-left:2px;;color:#2B8CB4;" onmouseover="javascript:$(\'help\').style.backgroundColor=\'#98DEFD\';" onmouseout="javascript:$(\'help\').style.backgroundColor=\'#FEFEFE\';" onclick="javascript:get_gadgets('+gid+'); return false;"><img src="http://www.smartwebgadgets.com/gad_image/question.gif" border="0" >&nbsp;Help</div>'; 
	   document.body.appendChild(p);
	   new Effect.toggle('spn_logo_poped','appear',{duration:0.5});
	 }
  }
  else { 
	 if ($('spn_logo_poped') ) 
	   new Effect.toggle('spn_logo_poped','appear',{duration:0.5,afterFinishInternal:function(){$('spn_logo_poped').remove();}});
	   //$('spn_logo_poped').remove();
  }
} // end function
*/

/*-................................................................................-*/
function send_to_frnd(gid) { 
  $('spn_logo_poped').remove();
  var spnpos = Position.cumulativeOffset($('spn_logo_options'));
  p = document.createElement('div');
  p.id = 'sendtofrnd';
  p.className = 'spn_logo_class';
  Element.setStyle(p,{zIndex:1000,position:'absolute',width:'200px',height:'120px',top:spnpos[1]-123+'px',left:spnpos[0]-129+'px',display:'block',border:'1px solid #008CB4',backgroundColor:'#B9EAF8'});
  p.innerHTML = '<div style="border:1px solid #4B6971;cursor:pointer;text-align:left;padding-left:2px;"><strong>Send To Your Friends</strong></div>'; 
  p.innerHTML += '<div id="sendstatus" style="text-align:center;padding-left:2px;display:none;"><img src="http://www.smartwebgadgets.com/images/indicator.gif" border="0">&nbsp;Processing....Please Wait...<img src="http://www.smartwebgadgets.com/images/indicator.gif" border="0"></div>'; 
  p.innerHTML += '<div id="sendtofriend" style="text-align:left;padding-left:2px;padding-bottom:5px;">Your Name:* <input style="width:100px;height:10px;font-family:Arial, Helvetica, sans-serif;font-size:11px;color:#404040;background-color:#AEBEC2;" type="text" id="yourname" /><br />To Email:*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input style="width:100px;height:10px;font-family:Arial, Helvetica, sans-serif;font-size:11px;color:#404040;background-color:#AEBEC2;" type="text" id="toemail" /> <input type="hidden" id="gadgetid" value="'+gid+'" /></div>'; 
  p.innerHTML += '<div id="help" style="text-align:center;padding-left:2px;">&nbsp;&nbsp;&nbsp;&nbsp;<input style="height:20px;font-family:Arial, Helvetica, sans-serif;font-size:10px;color:#404040;background-color:#AEBEC2;" type="button" value="Send" onclick="javascript:sendgadgettofriend(); return false;" />&nbsp;&nbsp;<input  style="height:20px;font-family:Arial, Helvetica, sans-serif;font-size:10px;color:#404040;background-color:#AEBEC2;" type="button" value="Cancel" onclick="javascript:$(\'sendtofrnd\').remove();" /></div>'; 
   p.innerHTML += '<div style="text-align:left"><strong>Hints:</strong> Use Comma(,) after an address to send multiple. </div>';
  document.body.appendChild(p);
}
	
	
	
function get_gadgets(gid) { 
  location.href = 'http://www.smartwebgadgets.com/get-gadgets.php?id='+gid;
}

function sendgadgettofriend() { 
  if ( ($('yourname').value == '') || ($('toemail').value == '') ) { alert('Required Value Missing!!!'); return; }
  $('sendstatus').style.display = 'block';
  var parms = 'sender='+$('yourname').value+'&toemail='+$('toemail').value+'&gadgetid='+$('gadgetid').value;
  new Ajax.Updater('sendstatus', 'http://www.smartwebgadgets.com/sendtofriend.php', {method: 'post', parameters: parms});
}

/*-................................................................................-*/

function show_gadgets(obj) {
 if( ($(obj).value == '') || ($(obj).value == null) ) return false;
 location.href = 'http://www.smartwebgadgets.com/gadgets.php?id='+$(obj).value;
}

/*-................................................................................-*/
function gadgets_add_your_site(obj) { 
 if( ($(obj).value == '') || ($(obj).value == null) ) return false;
 location.href = 'http://www.smartwebgadgets.com/get-gadgets.php?id='+$(obj).value;
}
/*-................................................................................-*/

function select_source() { 
  obj = $('gad_code').select();
}

/*-................................................................................-*/
function select_color(borderc,topc,gid) { 
 $('gadgets_container').style.border = '7px solid #'+borderc;
 $('gadgets_container_header').style.backgroundColor = '#'+topc;
 $('gad_code').value = '<script language="javascript" src="http://www.jargamms.com/swg/import.php?id='+gid+'&b='+borderc+'&t='+topc+'" type="text/javascript"></script>';
 
}

/*-................................................................................-*/
function contact_us() { 
 if ( ($('sname').value == '') || ($('email').value == '') || ($('subject').value == '') || ($('comments').value == '')  ) { alert('All the Fields Are Required.'); return false;}
 var emailchar = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
 if ( !emailchar.test($('email').value)) {alert('Seems the E-Mail Address is Invalid. Try with Correct One.'); return false;}
 var parms =Form.serialize('contact_form');
 $('send_status').innerHTML = '<img src="http://www.smartwebgadgets.com/images/indicator.gif" border="0" alt="working">...Processing Information to Send.....Please Wait.....<img src="http://www.smartwebgadgets.com/images/indicator.gif" border="0" alt="working">';
 new Ajax.Request('http://www.smartwebgadgets.com/contact-us-send.php', {method: 'post', parameters: parms, onComplete: contact_sending});
}
function contact_sending(creq) { 
   if ( creq.responseText == 'success') { 
      $('send_status').innerHTML = 'Your Information Has Been Successfully Sent. Someone Will Get Back To You Soon.';
	  Form.reset('contact_form');
   }
   else { 
     $('send_status').innerHTML = creq.responseText;
   }
}
/*-................................................................................-*/
function submit_req_customize() { 
 if ( ($('businessname').value == '') || ($('weburl').value == '') || ($('description').value == '') || ($('email').value == '') || ($('fullname').value == '')  ) { alert('All the Fields Are Required.'); return false;}
 var emailchar = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
 if ( !emailchar.test($('email').value)) {alert('Seems the E-Mail Address is Invalid. Try with Correct One.'); return false;}
 var parms = Form.serialize('cus_req_form');
 $('send_status').innerHTML = '<img src="http://www.smartwebgadgets.com/images/indicator.gif" border="0" alt="working">...Processing Information to Send.....Please Wait.....<img src="http://www.smartwebgadgets.com/images/indicator.gif" border="0" alt="working">';
 new Ajax.Request('http://www.smartwebgadgets.com/customized-send.php', {method: 'post', parameters: parms, onComplete: contact_custom_sending});
}
function contact_custom_sending(creq) { 
   if ( creq.responseText == 'success') { 
      $('send_status').innerHTML = 'Your Information Has Been Successfully Sent. Someone Will Get Back To You Soon.';
	  Form.reset('cus_req_form');
   }
   else { 
     $('send_status').innerHTML = creq.responseText;
   }
}
/*-................................................................................-*/
function check_availability() { 
  var val = $('username').value;
  if (val == '') { alert('No Input given'); return false; }
  $('send_status').innerHTML = '<img src="./images/indicator.gif" border="0" />&nbsp;Checking Please Wait....&nbsp;<img src="./images/indicator.gif" border="0" />';
  var parms = 'username='+val;
  new Ajax.Updater('send_status','http://www.smartwebgadgets.com/availability.php', {method: 'post', parameters: parms});
}

/*-................................................................................-*/

function sigupnow() { 
 if ( ($('username').value == '') || ($('email').value == '') || ($('password').value == '') || ($('cpassword').value == '') || ($('website').value == '') || ($('fullname').value == '')  ) { 
    alert('Required Value Missing.'); return false;
 }



 var emailchar = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
 if ( !emailchar.test($('email').value)) {alert('Seems the E-Mail Address is Invalid. Try with Correct One.'); return false;}
 
 
 
 var parms =Form.serialize('signup_form');
 $('send_status').innerHTML = '<img src="http://www.smartwebgadgets.com/images/indicator.gif" border="0" alt="working">...Processing Information to Send.....Please Wait.....<img src="http://www.smartwebgadgets.com/images/indicator.gif" border="0" alt="working">';
 new Ajax.Request('http://www.smartwebgadgets.com/singup-process.php', {method: 'post', parameters: parms, onComplete: signup_sending});
}
function signup_sending(ssreq) { 
   if ( ssreq.responseText == 'success') { 
      $('send_status').innerHTML = 'Your Information Has Been Successfully Saved. Please Check Your E-mail Inbox.';
	  Form.reset('signup_form');
   }
   else { 
     $('send_status').innerHTML = ssreq.responseText;
   }


}



/*-................................................................................-*/
/*-................................................................................-*/
/*-................................................................................-*/
/*-................................................................................-*/
/*-................................................................................-*/
