//Disable right mouse click Script
//By Maximus (maximus@nsimail.com) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com

/*var message="Copyright CandidImage.com";

///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}

function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}

if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}

document.oncontextmenu=new Function("alert(message);return false")
*/
//window open function

function wopen(url,title,top,left,width,height)
{     var win = null;

    //closing an already opened window
    if (win) {
        win.close();
    }
         //creating the new window
        win = window.open(url,title,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,top=" + top + ",left=" + left + ",width=" + width + ",height=" + height);

}

//Highlight form element- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com

var highlightcolor="#F3DDDD"

var ns6=document.getElementById&&!document.all
var previous=''
var eventobj

//Regular expression to highlight only form elements
var intended=/INPUT|TEXTAREA|SELECT|OPTION/

//Function to check whether element clicked is form element
function checkel(which){
if (which.style&&intended.test(which.tagName)){
if (ns6&&eventobj.nodeType==3)
eventobj=eventobj.parentNode.parentNode
return true
}
else
return false
}

//Function to highlight form element
function highlight(e){
eventobj=ns6? e.target : event.srcElement
if (previous!=''){
if (checkel(previous))
previous.style.backgroundColor='#DCD3E6'
previous=eventobj
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
}
else{
if (checkel(eventobj))
eventobj.style.backgroundColor=highlightcolor
previous=eventobj
}
}

function confsubmit()
{
var Message='Please correct the following errors:\n';
var tempmsg='';
  if (document.contactform.sendersname.value=='')
  {
   tempmsg=tempmsg + 'Please enter your name\n'
  }
  if ((document.contactform.sendersemail.value=='') || (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.contactform.sendersemail.value))))
  {
   tempmsg=tempmsg + 'Please enter a valid e-mail\n'
  }

  if (document.contactform.message.value=='')
  {
    tempmsg=tempmsg + 'Please type in your message\n'
  }

    if(tempmsg=='')
    {
    document.contactform.submit();
    }
    else
    {
     Message=Message + '=======================\n' +  tempmsg + '=======================';
     alert(Message);
    }
}


function confsign()
{
var Message='Please correct the following errors:\n';
var tempmsg='';
  if (document.gbookform.name.value=='')
  {
   tempmsg=tempmsg + 'Please enter your name\n'
  }
  if ((document.gbookform.email.value=='') || (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.gbookform.email.value))))
  {
   tempmsg=tempmsg + 'Please enter a valid e-mail\n'
  }

  if (document.gbookform.textarea.value=='')
  {
    tempmsg=tempmsg + 'Please type in your comments\n'
  }

    if(tempmsg=='')
    {
    document.gbookform.submit();
    }
    else
    {
     Message=Message + '=======================\n' +  tempmsg + '=======================';
     alert(Message);
    }
}

function toggle(target)
  {
     obj=(document.all) ? document.all[target] : document.getElementById(target);
     obj.style.display=(obj.style.display=='none') ? 'inline' : 'none';
  }
function revtoggle(target)
  {
     obj=(document.all) ? document.all[target] : document.getElementById(target);
     obj.style.display=(obj.style.display=='inline') ? 'none' : 'inline';
  }

function submitval()
{
var message='Please enter correctly the following information\n'
  var temp='';

  if (document.register.member_name.value=='')
    {
        temp=temp + 'Full Name\n';
    }
if (document.register.member_email.value==''|| (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.register.member_email.value))))
    {
        temp=temp + 'E-mail\n';
    }
if (document.register.member_password.value=='')
    {
        temp=temp + 'Password\n';
    }


if (document.register.password2.value=='')
    {
        temp=temp + 'Confirm Password \n';

    }


if (document.register.password2.value!==document.register.member_password.value)
    {
        temp=temp + 'Passwords do not match \n';

    }


if (temp!='')
    {
    message=message + '=============================\n' + temp + '=============================\n';
    alert(message);
    return false;
    }
    else
    {

    document.register.submit();
    }
}

function updateval()
{
var message='Please enter correctly the following information\n'
  var temp='';

  if (document.update.member_name.value=='')
    {
        temp=temp + 'Full Name\n';
    }
/*if (document.register.member_email.value==''|| (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.register.member_email.value))))
    {
        temp=temp + 'E-mail\n';
    }*/
if (document.update.member_password.value=='')
    {
        temp=temp + 'Password\n';
    }


if (document.update.password2.value=='')
    {
        temp=temp + 'Confirm Password \n';

    }


if (document.update.password2.value!==document.update.member_password.value)
    {
        temp=temp + 'Passwords do not match \n';

    }


if (temp!='')
    {
    message=message + '=============================\n' + temp + '=============================\n';
    alert(message);
    return false;
    }
    else
    {

    document.update.submit();
    }
}


  function verifylogin()
    {
    var message;
    var tempmsg
    tempmsg= ' ';
    message = 'Please correct the following errors:';

    if (document.login.email.value==''|| (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.login.email.value))))

        {
        tempmsg=tempmsg + '\n    Please enter an Email';
        }

    if (document.login.password.value=="")
        {
        tempmsg=tempmsg + '\n    Please enter a Password';
        }
        if (tempmsg!=' ')
        {
        message=message + '\n==============================';
        message=message+ tempmsg;
        message=message + '\n==============================';
        alert(message);

        }
        else
        {
        document.login.submit();
        }
    }


    function verifyactivate()
    {
    var message;
    var tempmsg
    tempmsg= ' ';
    message = 'Please correct the following errors:';

    if (document.activate.email.value==''|| (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.activate.email.value))))

        {
        tempmsg=tempmsg + '\n    Please enter a valid Email';
        }

    if (document.activate.activecode.value=="")
        {
        tempmsg=tempmsg + '\n    Please enter an activation code';
        }
        if (tempmsg!=' ')
        {
        message=message + '\n==============================';
        message=message+ tempmsg;
        message=message + '\n==============================';
        alert(message);

        }
        else
        {
        document.activate.submit();
        }
    }

    function verifyresend()
    {
    var message;
    var tempmsg
    tempmsg= ' ';
    message = 'Please correct the following errors:';

    if (document.sendcode.usersactivecode.value==''|| (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.sendcode.usersactivecode.value))))

        {
        tempmsg=tempmsg + '\n    Please enter a valid Email';
        }

        if (tempmsg!=' ')
        {
        message=message + '\n==============================';
        message=message+ tempmsg;
        message=message + '\n==============================';
        alert(message);

        }
        else
        {
        document.sendcode.submit();
        }
    }


    function totalit (item_price,region_shipping)
    {
     var item_quantity=Math.abs(document.orderForm.orders_quantity.value)

       if ((item_quantity=="") || (item_quantity==0))
      {
       document.orderForm.orders_quantity.value='1';
       item_quantity=1
       // totalit(item_price,region_shipping);
      }

     document.orderForm.orders_total.value=(item_quantity * item_price + region_shipping);

    }
    function validate(theForm){

    if ( (theForm.email.value == "") || (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(theForm.email.value)))){
        alert("Please enter a valid email address.");
        theForm.email.focus();
        return false;
    }

return true;
}