function artworkChange(selObject)
{
	var oCtrl 
	oCtrl = document.getElementById("uploadArtwork"); 
	
	if (oCtrl != null)
	{ 
		if (selObject.selectedIndex == 0) 
		{
				oCtrl.style.display = "";
		}	else {
				oCtrl.style.display = "none";
		}
	}
}


function CommonForm_Validate()
{
	var bolReturn = true;
	
	var oCtrl 
	
	oCtrl = document.getElementById("Name"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
		
	oCtrl = document.getElementById("Email"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '' || !emailCheck(oCtrl.value))
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("Comments"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 

	return bolReturn;
}

function QueryForm_Validate()
{
	
	var bolReturn = true;
	
	var oCtrl 
	
	oCtrl = document.getElementById("FirstName"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("LastName"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 

	
	oCtrl = document.getElementById("EmailAddress"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '' || !emailCheck(oCtrl.value))
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("Telephone"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '' || !checkInternationalPhone(oCtrl.value))
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("NameProject"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("TypeProject"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("DateNeeded"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '' || oCtrl.value == 'Month / Day / Year')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("Quantity"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	return bolReturn;
}

function UploadForm_Validate()
{
	var bolReturn = true;
	
	var oCtrl 
	
	oCtrl = document.getElementById("Name"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("Email"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '' || !emailCheck(oCtrl.value))
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("Telephone"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '' || !checkInternationalPhone(oCtrl.value))
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("FileType"); 
	
	if (oCtrl != null)
	{ 
		if (oCtrl.selectedIndex == 0) 
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}	
		else {
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	}
	
	oCtrl = document.getElementById("Software"); 
	
	if (oCtrl != null)
	{ 
		if (oCtrl.selectedIndex == 0) 
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}	
		else {
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	}
	
	return bolReturn;
}

function User_Validate()
{
	var bolReturn = true;
	
	var oCtrl 
	
	oCtrl = document.getElementById("FirstName"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("LastName"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 

	
	oCtrl = document.getElementById("EmailAddress"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '' || !emailCheck(oCtrl.value))
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("DirectLine"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '' || !checkInternationalPhone(oCtrl.value))
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("Mobile"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '' || !checkInternationalPhone(oCtrl.value))
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("Username"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '' )
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("Password"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '' )
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	return bolReturn;
}

function SubCat_Validate()
{
	var bolReturn = true;
	
	var oCtrl 
	
	oCtrl = document.getElementById("Title"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 
	
	oCtrl = document.getElementById("Description"); 
	if (oCtrl != null)
	{ 
		if (oCtrl.value == '')
		{
			oCtrl.style.backgroundColor="#f193a0";
			oCtrl.style.color="#FFFFFF";
			bolReturn = false;
		}
		else
		{
			oCtrl.style.backgroundColor="#FFFFFF";
			oCtrl.style.color="#333333";
		}
	} 

	return bolReturn;
}

function urlCheck(str) {
	var v = new RegExp();
		v.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
		if (!v.test(str)) {
		return false;
	}
	return true;
} 


function emailCheck(emailStr) {
	
	var checkTLD=1;
	
	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;
	
	var emailPat=/^(.+)@(.+)$/;
	
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";
	
	var validChars="\[^\\s" + specialChars + "\]";
	
	var quotedUser="(\"[^\"]*\")";
	
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	
	var atom=validChars + '+';
	
	var word="(" + atom + "|" + quotedUser + ")";
	
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");
	
	var matchArray=emailStr.match(emailPat);
	
	if (matchArray==null) {
	
	//alert("Email address seems incorrect (check @ and .'s)");
	return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];
	
	for (i=0; i<user.length; i++) {
	if (user.charCodeAt(i)>127) {
	//alert("Ths username contains invalid characters.");
	return false;
	   }
	}
	for (i=0; i<domain.length; i++) {
	if (domain.charCodeAt(i)>127) {
	//alert("This domain name contains invalid characters.");
	return false;
	   }
	}
	
	if (user.match(userPat)==null) {
	
	//alert("The username doesn't seem to be valid.");
	return false;
	}
	
	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
	
	for (var i=1;i<=4;i++) {
	if (IPArray[i]>255) {
	//alert("Destination IP address is invalid!");
	return false;
	   }
	}
	return true;
	}
	 
	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
	if (domArr[i].search(atomPat)==-1) {
	//alert("The domain name does not seem to be valid.");
	return false;
	   }
	}
	
	if (checkTLD && domArr[domArr.length-1].length!=2 && 
	domArr[domArr.length-1].search(knownDomsPat)==-1) {
	//alert("The address must end in a well-known domain or two letter " + "country.");
	return false;
	}
	
	if (len<2) {
	//alert("This address is missing a hostname!");
	return false;
	}
	return true;
}




// Declaring required variables
var digits = "0123456789";
// non-digit characters which are allowed in phone numbers
var phoneNumberDelimiters = "()- ";
// characters which are allowed in international phone numbers
// (a leading + is OK)
var validWorldPhoneChars = phoneNumberDelimiters + "+";
// Minimum no of digits in an international phone no.
var minDigitsInIPhoneNumber = 10;

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}

function checkInternationalPhone(strPhone){
	var objRegExp  =  /^([0-1]([\s-./\\])?)?(\(?[2-9]\d{2}\)?|[2-9]\d{3})([\s-./\\])?(\d{3}([\s-./\\])?\d{4}|[a-zA-Z0-9]{7})$/;
	return objRegExp.test(strPhone);
}


function movepic(img_nameid, img_strPicid,img_strCurPos, direction, totalnum) {
    var direction = parseInt(direction);
    var totalnum = parseInt(totalnum);
    var strPicName = document.getElementById(img_strPicid).value;
    var currentPosition = parseInt(document.getElementById(img_strCurPos).value);
    
    var position = currentPosition + direction
    
	//alert(position);	
		if (position < 0) {
				position = totalnum - 1
		}
		else {
			if (position >= totalnum) {
			position = 0
			}
		}
	//alert(position);	
    var arrPicName = new Array();
    var a = strPicName.split(':::');
    for (var i = 0; i < a.length - 1; i++) {
        if (a[i] != "") {
            //alert(a[i]);
            arrPicName.push(a[i]);
        }
    }

    for (var i = 0; i < arrPicName.length; i++) {
        if(i == position) {
		      img_src = "../images/Product_Photos/" + arrPicName[i];

			    document.getElementById(img_nameid).src = img_src;
			    document.getElementById(img_strCurPos).value = position;
		      break;
        }
    }

}

