/*Bookmark Script*/

function bookmark()
{
	if (window.sidebar) // firefox
	{
		alert("mozila");
		window.sidebar.addPanel("Exotichighheels.com - " + document.title, window.location , "");
	}
	else if(window.opera && window.print)
	{ // opera
		var elem = document.createElement('a');
		elem.setAttribute('href',window.location);
		elem.setAttribute('title',document.title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else if(document.all)
	{// ie
	window.external.AddFavorite(window.location, 'Exotichighheels.com - ' + document.title);
	}else
	{
	alert("Sorry! Your browser doesn't support this function. Please press Ctrl+D to bookmark this site.");
	}
}
function book()
{
	alert("bookmark");
	if(document.all)
	{// ie
	alert("ie");
	window.external.AddFavorite(window.location, 'Exotichighheels.com - ' + document.title);
	}
	else if(window.sidebar) // firefox
	{
		alert("mozila");
		window.sidebar.addPanel("Exotichighheels.com - " + document.title, window.location , "");
	}	
	else if(window.opera && window.print)
	{ // opera
		alert("opera");
		var elem = document.createElement('a');
		elem.setAttribute('href',window.location);
		elem.setAttribute('title',document.title);
		elem.setAttribute('rel','sidebar');
		elem.click();
	} 
	else
	{
	alert("Sorry! Your browser doesn't support this function. Please press Ctrl+D to bookmark this site.");
	}
}


function AddBookmark(title,url) 
{ 
var ie=navigator.userAgent.toLowerCase();
var ua=navigator.userAgent.toLowerCase();
var isSafari=(ua.indexOf('webkit')!=-1);
var ie78=(ie.indexOf('msie 8')!=-1);
//alert(ie78)
if(ie78)
  {//alert("You need to press ctrl + D to bookmark our site.");
}
if(isSafari)
  {alert("You need to press ctrl + D to bookmark our site.");
}
if( document.all ) {
window.external.AddFavorite( url, title);
} else if( window.opera && window.print ) {
return true; 
}
else if (window.sidebar) { 
window.sidebar.addPanel(title, url,""); 
} 
}


/*Validation for Contact us page*/

function validate1(frm) 
{ 
sname = frm.name; 
semail = frm.email; 
message = frm.comments; 
 
err_flag = 0; 
 
if (sname.value == "" || !removeSpaces(sname.value)) 
  { 
   alert ("Please enter proper Name!"); 
   sname.focus(); 
   sname.value=""; 
   return false;  
  } 
  else if (semail.value == "" || !validate_email(semail.value)) 
   { 
   alert ("Please enter proper Email!"); 
   semail.focus(); 
   return false;  
  } 
 
  else if (message.value == "" || !removeSpaces(message.value)) 
    { 
     alert ("Comment should not be blank!"); 
     message.focus(); 
     message.value=""; 
     return false; 
    }
 
} 
 
function validate_email(e) 
{ 
var str=e; 
var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; 
 
if (!filter.test(str)) 
  return false; 
else 
  return true; 
} 
 
function removeSpaces(string) { 
var tstring = ""; 
string = '' + string; 
splitstring = string.split(" "); 
for(i = 0; i < splitstring.length; i++) 
tstring += splitstring[i]; 
return tstring; 
}

/*Validation Newsletter*/

function signupvalid(frm)
{

  fname = frm.name;
  var fname1=fname.value;
  em1 = document.getElementById('catreq-email')
  em = document.getElementById('catreq-email').value;

   
 
if (em == "" || em == "email address" || !validate_email(em)) 
   { 
   alert ("Please enter proper Email!"); 
   em1.focus(); 
   return false;  
  } 

 
 
 
  
}

function validate_eml(e)
{
 var str=e;
 var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

 if (!filter.test(str))
  return false;
 else
  return true;
}


/*Validation of Tell a Friend*/

function validate(frm)
{
 name1 = frm.sName;
 name2=frm.name1;
 email = frm.sEmail;
 email2=frm.email1;
/// alert(name2.value);
 //alert(email2/valu);


 err_flag = 0;
 
 if (name1.value == "" || !removeSpaces(name1.value))
  {
   alert ("Please enter proper Name!");
    name1.focus();
   return false; 
   name1.value="";
  
  }
  else if (email.value == "" || !validate_email(email.value))
   {
   alert ("Please enter proper Email!");
   email.focus();
   return false; 
  }
 
 
 if (name2.value == "" || !removeSpaces(name2.value))
  {
   alert ("Please enter proper Friend's Name.!");
    name2.focus();
   return false; 
   name2.value="";
  
  }
  else if (email2.value == "" || !validate_email(email2.value))
   {
   alert ("Please enter proper Friend's Email.!");
   email2.focus();
   return false;    
  }
}

function validate_email(e)
{
 var str=e;
 var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;

 if (!filter.test(str))
  return false;
 else
  return true;
}

function removeSpaces(string) {
 var tstring = "";
 string = '' + string;
 splitstring = string.split(" ");
 for(i = 0; i < splitstring.length; i++)
 tstring += splitstring[i];
 return tstring;
}

/*Validation for constant contact*/
function validateConstant(frm)
{
	 
	email = frm.ea;
 

	err_flag = 0;
	
if (email.value == "" || !validate_email(email.value))
			{
			alert ("Please enter proper Email!");
			email.focus();
			return false;	
		}

}

function validate_email(e)
{
	var str=e;
	var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i

	if (!filter.test(str))
		return false;
	else
		return true;
}
