

function del(id)
{
     if(confirm("Sure you want to delete this Quote? There is NO undo!"))
			{

document.location.href='admin_home.php?action=delete&id='+id;

			}
}
function delcareer(id)
{
     if(confirm("Sure you want to delete this entry? There is NO undo!"))
			{

document.location.href='admin_careers.php?action=delete&id='+id;

			}
}
function delfeedback(id)
{
     if(confirm("Sure you want to delete this entry? There is NO undo!"))
			{

document.location.href='admin_feedback.php?action=delete&id='+id;

			}
}
function delnewsletter(id)
{
     if(confirm("Sure you want to delete this entry? There is NO undo!"))
			{

document.location.href='admin_newsletter.php?action=delete&id='+id;

			}
}
function delnews(id)
{
     if(confirm("Sure you want to delete this entry? There is NO undo!"))
			{

document.location.href='admin_news.php?action=delete&id='+id;

			}
}




//validate quick_quote..............
function validate_quick_quote(quick_quote)
{

var numberRegex = /^[0-9]+/;
var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

var quote_request = quick_quote.quote_request.value;
var description=quick_quote.description.value;
var name=quick_quote.name.value;
var organisation=quick_quote.organisation.value;
var phone=quick_quote.phone.value;
var email=quick_quote.email.value;

 if(quote_request == "")
   {
  
  inlineMsg('imageid','You must enter your  Quote request...',4);
  return false;
  }
    
if(description == "")
   {
  
  inlineMsg('imageid','You must enter your Description...',4);
  return false;
  }
 
 if(name=="")
 {
 inlineMsg('imageid','Please enter your Name...',4);
 return false;
 }
 
 if(organisation=="")
 {
 inlineMsg('imageid','Please specify your Organisation...',4);
 return false;
 }
 
 if(phone=="")
 {
 inlineMsg('imageid','Please enter your Phone number...',4);
 return false;
 }
   if(!phone.match(numberRegex)) {
    inlineMsg('imageid','You have entered an invalid Phone number.',4);
   return false;
 }
 
 
  if(email=="")
 {
 inlineMsg('imageid','Please enter your email address...',4);
 return false;
 }
  if(!email.match(emailRegex)) {
    inlineMsg('imageid','You have entered an invalid email.');
   return false;
 }
 
  
   return true;
		
}




//validate enquiry..............
function validate_enquiry(quick_quote)
{

var numberRegex = /^[0-9]+/;
var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

var organisation = quick_quote.organisation.value;
var name=quick_quote.name.value;
var phone=quick_quote.phone.value;
var email=quick_quote.email.value;
var quote_request=quick_quote.quote_request.value;
var description=quick_quote.description.value;


 if(organisation == "")
   {
  
  inlineMsg('organisation','You must enter your  Organisation ...',4);
  return false;
  }
    
if(name == "")
   {
  
  inlineMsg('name','You must enter your Name...',4);
  return false;
  }
 
 if(phone=="")
 {
 inlineMsg('phone','Please enter your Phone number...',4);
 return false;
 }
   if(!phone.match(numberRegex)) {
    inlineMsg('phone','You have entered an invalid Phone number.',4);
   return false;
 }
 
  if(email=="")
 {
 inlineMsg('email','Please enter your email address...',4);
 return false;
 }
  if(!email.match(emailRegex)) {
    inlineMsg('email','You have entered an invalid email.');
   return false;
 }
 
 if(quote_request=="")
 {
 inlineMsg('quote_request','Please specify your Product...',4);
 return false;
 }
 
if(description=="")
 {
 inlineMsg('description','Please specify your Your requirements...',4);
 return false;
 }
 
  
   return true;
		
}



//validate feedback..............
function validate_feedback(quick_quote)
{

var numberRegex = /^[0-9]+/;
var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

var name=quick_quote.name.value;
var email=quick_quote.email.value;
var phone=quick_quote.phone.value;
var comment=quick_quote.comment.value;

if(name == "")
   {
  
  inlineMsg('name','You must enter your Name...',4);
  return false;
  }
  
  if(email=="")
 {
 inlineMsg('email','Please enter your email address...',4);
 return false;
 }
  if(!email.match(emailRegex)) {
    inlineMsg('email','You have entered an invalid email.');
   return false;
 }
 
 if(phone=="")
 {
 inlineMsg('phone','Please enter your Phone number...',4);
 return false;
 }
   if(!phone.match(numberRegex)) {
    inlineMsg('phone','You have entered an invalid Phone number.');
   return false;
 }
 
    
if(comment=="")
 {
 inlineMsg('comment','Please specify your Your comment...',4);
 return false;
 }
 
  
   return true;
		
}

//validate career..............
function validate_career(quick_quote)
{

var numberRegex = /^[0-9]+/;
var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

var your_name=quick_quote.your_name.value;
var email=quick_quote.email.value;
var state=quick_quote.state.value;
var district=quick_quote.district.value;
var location=quick_quote.location.value;
 
 if(location=="otherplace") {
     var location1=document.getElementById("location1").value;
    }
 
var mobile=quick_quote.mobile.value;
var year=quick_quote.year.value;
var month=quick_quote.month.value;
var functional_area=quick_quote.functional_area.value;
var key_skills=quick_quote.key_skills.value;
var resume=quick_quote.resume.value;
var graduation=quick_quote.graduation.value;

var resfile=quick_quote.resfile.value;

 if(your_name =="")
   {
  
  inlineMsg('your_name','You must enter   your name...',4);
  return false;
  }
    
	  if(email=="")
 {
 inlineMsg('email','Please enter your email address...',4);
 return false;
 }
  if(!email.match(emailRegex)) {
    inlineMsg('email','You have entered an invalid email.');
   return false;
 }
	
if(state=="")
   {
  
  inlineMsg('state','You must enter your state...',4);
  return false;
  }
 
 if(district=="")
 {
 inlineMsg('district','Please enter your district...',4);
 return false;
 }
 
 if(location=="")
 {
 inlineMsg('location','Please specify your location...',4);
 return false;
 }
 
  if(location =="otherplace") {
    if(location1=="") {
    inlineMsg('location1','Please Type Your Location Here ...');
    return false;
	}
    }
  
 
 if(mobile=="")
 {
 inlineMsg('mobile','Please enter your Phone number...',4);
 return false;
 }
   if(!mobile.match(numberRegex)) {
    inlineMsg('mobile','You have entered an invalid Phone number.',4);
   return false;
 }
 
 if(year=="")
 {
 inlineMsg('year','Please enter your year...',4);
 return false;
 }
 
 if(month=="")
 {
 inlineMsg('month','Please enter your month...',4);
 return false;
 }
 
 if(functional_area=="")
 {
 inlineMsg('functional_area','Please enter your functional_area...',4);
 return false;
 }
 
if(key_skills=="")
 {
 inlineMsg('key_skills','Please enter your key_skills...',4);
 return false;
 }
 
 if(resume=="")
 {
 inlineMsg('resume','Please enter your resume...',4);
 return false;
 }
  if(graduation=="")
 {
 inlineMsg('graduation','Please enter your graduation...',4);
 return false;
 }
  if(resfile=="")
 {
 inlineMsg('resfile','Please enter your attach_resume...',10);
 return false;
 }	
   return true;
		
}

//validate news letter.............
function validate_news_letter_email(quick_quote)
{
var numberRegex = /^[0-9]+/;
var emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/;

var newsemail=quick_quote.newsemail.value;

  if(newsemail=="")
 {
 inlineMsg('newsemail','Please enter your email address...',4);
 return false;
 }
  if(!newsemail.match(emailRegex)) {
    inlineMsg('newsemail','You have entered an invalid email.');
   return false;
 }
 
    return true;
		
}


// START OF MESSAGE SCRIPT //


var MSGTIMER = 20;
var MSGSPEED = 10;
var MSGOFFSET = 10;
var MSGHIDE = 100;

// build out the divs, set attributes and call the fade function //
function inlineMsg(target,string,autohide) {
  var msg;
  var msgcontent;
  if(!document.getElementById('msg')) {
    msg = document.createElement('div');
    msg.id = 'msg';
    msgcontent = document.createElement('div');
    msgcontent.id = 'msgcontent';
    document.body.appendChild(msg);
    msg.appendChild(msgcontent);
    msg.style.filter = 'alpha(opacity=0)';
    msg.style.opacity = 0;
    msg.alpha = 0;
  } else {
    msg = document.getElementById('msg');
    msgcontent = document.getElementById('msgcontent');
  }
  msgcontent.innerHTML = string;
  msg.style.display = 'block';
  var msgheight = msg.offsetHeight;
  var targetdiv = document.getElementById(target);
  targetdiv.focus();
  var targetheight = targetdiv.offsetHeight;
  var targetwidth = targetdiv.offsetWidth;
  var topposition = topPosition(targetdiv) - ((msgheight - targetheight) / 2);
  var leftposition = leftPosition(targetdiv) + targetwidth + MSGOFFSET;
  msg.style.top = topposition + 'px';
  msg.style.left = leftposition + 'px';
  clearInterval(msg.timer);
  msg.timer = setInterval("fadeMsg(1)", MSGTIMER);
  if(!autohide) {
    autohide = MSGHIDE;  
  }
  window.setTimeout("hideMsg()", (autohide * 1000));
}

// hide the form alert //
function hideMsg(msg) {
  var msg = document.getElementById('msg');
  if(!msg.timer) {
    msg.timer = setInterval("fadeMsg(0)", MSGTIMER);
  }
}

// face the message box //
function fadeMsg(flag) {
  if(flag == null) {
    flag = 1;
  }
  var msg = document.getElementById('msg');
  var value;
  if(flag == 1) {
    value = msg.alpha + MSGSPEED;
  } else {
    value = msg.alpha - MSGSPEED;
  }
  msg.alpha = value;
  msg.style.opacity = (value / 100);
  msg.style.filter = 'alpha(opacity=' + value + ')';
  if(value >= 99) {
    clearInterval(msg.timer);
    msg.timer = null;
  } else if(value <= 1) {
    msg.style.display = "none";
    clearInterval(msg.timer);
  }
}

// calculate the position of the element in relation to the left of the browser //
function leftPosition(target) {
  var left = 0;
  if(target.offsetParent) {
    while(1) {
      left += target.offsetLeft;
      if(!target.offsetParent) {
        break;
      }
      target = target.offsetParent;
    }
  } else if(target.x) {
    left += target.x;
  }
  return left;
}

// calculate the position of the element in relation to the top of the browser window //
function topPosition(target) {
  var top = 0;
  if(target.offsetParent) {
    while(1) {
      top += target.offsetTop;
      if(!target.offsetParent) {
        break;
      }
      target = target.offsetParent;
    }
  } else if(target.y) {
    top += target.y;
  }
  return top;
}

// preload the arrow //
if(document.images) 
{
  arrow = new Image(7,80); 
  arrow.src = "images/msg_arrow.gif"; 
}



