$(document).ready(function(){
	
	$('.slide_caption a').each(function(index) {
		$(this).bind (
			"click", 
			function (){
				window.open($(this).attr("href")); return false;
			});
	});


	$("#nColor").click(function (){
		window.open("http://www.ncolorsalon.com");
		return false;
	});
	
	$("#meToo").click(function (){
		// window.open("http://www.metoomakeup.com/");
		window.open("http://www.metoomakeup.com/","","width=850,height=850");

		return false;
	});

});

// Checks and verify Email
function emailCheck(str){
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	// check if string contains @sign
	if (str.indexOf(at)==-1){
	   return false
	}
	// check if @sign not at beginning of string
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}
	// check if period not at beginning of string
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}

	if (str.indexOf(at,(lat+1))!=-1){
		return false
	}

	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	}

	if (str.indexOf(dot,(lat+2))==-1){
		return false
	}
	
	if (str.indexOf(" ")!=-1){
		return false
	}

	 return true					
}// end function emailCheck


function mouseReallyOut(obj) {

if (!event.fromElement.contains(event.toElement) &&!document.getElementById(obj).contains(event.toElement))
{
	alert('out');//do something on mouse out;
}

return false;
}

function preloadImages(img_list) {
	var imgs = toArray(img_list);
	var step = 0;
	
	imgs.each(function(img) {
		var preload = new Image();
		preload.src = imgs[img].value;
		alert(preload.src);
	});
}

			
function upload_attachment(id){
	myForm = document.getElementById(id);
	myForm.submit();
}

