
var Logos = function () {
	var Slideshow = new noobSlide({ box: $('noob1'), items: [0,1,2,3,4], size: 923, autoPlay: true, interval: 5000,
			fxOptions: { duration: 750, transition: Fx.Transitions.Quad.easeInOut, wait: false } });
}

var Form = function () {
	var form_send = $('form-send');
	$('form-send').addEvent('mouseenter', function(){ form_send.setStyle('background-position', '0px -18px'); });
	$('form-send').addEvent('mouseleave', function(){ form_send.setStyle('background-position', '0px 0px'); });
}


window.addEvent('domready', function() {
	
	Logos();
	
	MiddleNav();
	
	Form();
	
});

var $j = jQuery.noConflict();

var moving = false;

$j(document).ready(function(){

	$j("#info-up").css("display","none");
		
	$j("#info-down").mousehold(function(){
		var top = $j("#info-box2").css("top");	
		var display = $j("#info-up").css("display");
		var height = $j('#info-box2').innerHeight();	
		var containerHeight = $j("#info-box1").css("height");
	
		top = top.replace("px","")
		containerHeight = containerHeight.replace("px","")
			
		top = parseInt(top)
		containerHeight = parseInt(containerHeight)
		
		var maxTop = height - containerHeight;
			
		maxTop = maxTop - (maxTop*2);
			
		var nextTop = top - 30;
	
		if (nextTop < maxTop) {			
			nextTop = maxTop;
		}
		
		if (display == "none") {		
			$j("#info-up").css("display","inline");
		}
		
		if (moving == false) {	
			moving = true;
			$j("#info-box2").animate({"top": nextTop}, 600,function(){
				 moving = false;
				 if (nextTop == maxTop) {
					$j("#info-down").css("display","none");
				}				 
			});
		}
	});	
	
	$j("#info-up").mousehold(function(){
		var top = $j("#info-box2").css("top");	
		var display = $j("#info-down").css("display");	
		top = top.replace("px","")	
		top = parseInt(top)
			
		maxTop = 0;
		
		var nextTop = top + 30;
		
		if (nextTop > maxTop) {		
			nextTop = maxTop;	
		}
		
		if (display == "none") {		
			$j("#info-down").css("display","inline");
		}
		
		if ((top < 0) && (moving == false)) {
			moving = true;
			$j("#info-box2").animate({"top": nextTop}, 600,function(){
				 moving = false;
				 if (nextTop == maxTop) {
					$j("#info-up").css("display","none");
				}	
			});
		}
		
	
	});
	
	
	// Logo Design - Turn on this light and turn off home light
	
	$j("#logo-design").mouseover(function(){
	
		$j("#logo-design > h2 > a").addClass("active");
		
		$j("#home > h2 > a").removeClass("active");
	
	});
	
	$j("#logo-design > h2 > a").mouseover(function(){
		
		$j("#logo-design > ul > li > h3 > a.portfolio-logo").stop().animate({height:'20px'},{queue:false, duration:1, easing: 'easeOutQuad'});
		
	});
	
	// Logo Design - Turn off this light and turn on home light
	
	$j("#logo-design").mouseout(function(){
	
		$j("#logo-design > h2 > a").removeClass("active");
		
		$j("#home > h2 > a").addClass("active");
	
	});
	
	// Logo Design - Slide out ul
	
	$j("#logo-design > h2 > a").mouseover(function(){
												   
		$j("#logo-design > ul").stop().animate({height:'94px'},{queue:false, duration:250, easing: 'easeOutQuad'});
	
	});
	
	// Logo Design - Slide in ul
	
	$j("#logo-design > h2 > a").mouseout(function(){
	
		$j("#logo-design > ul").stop().animate({height:'0px'},{queue:false, duration:250, easing: 'easeOutQuad'});
	
	});
	
	// Logo Design Sub Links - Stop ul from sliding back in
	
	$j("#logo-design > ul > li > h3 > a").mouseover(function(){
												   
		$j("#logo-design > ul").stop().animate({height:'94px'},{queue:false, duration:250, easing: 'easeOutQuad'})
	
	});
	
	// Logo Design Sub Links - Slide in ul
	
	$j("#logo-design > ul > li > h3 > a").mouseout(function(){
	
		$j("#logo-design > ul").stop().animate({height:'0px'},{queue:false, duration:250, easing: 'easeOutQuad'})
	
	});
	
	// Logo Design Sub Overview Link - Slide out
	
	$j("#logo-design > ul > li > h3 > a.overview").mouseover(function(){
												   
		$j("#logo-design > ul > li > h3 > a.portfolio-logo").stop().animate({height:'20px'},{queue:false, duration:250, easing: 'easeOutQuad'});
	
	});
	
	// Logo Design Sub Portfolio Link - Slide out
	
	$j("#logo-design > ul > li > h3 > a.portfolio-logo").mouseover(function(){
												   
		$j("#logo-design > ul > li > h3 > a.portfolio-logo").stop().animate({height:'106px'},{queue:false, duration:250, easing: 'easeOutQuad'});
		
		$j("#logo-design > ul").stop().animate({height:'180px'},{queue:false, duration:250, easing: 'easeOutQuad'});
	
	});
	
	// Logo Design Sub Prices Link - Slide out
	
	$j("#logo-design > ul > li > h3 > a.prices").mouseover(function(){
												   
		$j("#logo-design > ul > li > h3 > a.prices").stop().animate({height:'107px'},{queue:false, duration:250, easing: 'easeOutQuad'});
		
		$j("#logo-design > ul").stop().animate({height:'180px'},{queue:false, duration:250, easing: 'easeOutQuad'});
	
	});
	
	
	// Corporate Identity Design - Turn on this light and turn off home light
	
	$j("#corporate-identity-design").mouseover(function(){
	
		$j("#corporate-identity-design > h2 > a").addClass("active");
		
		$j("#home > h2 > a").removeClass("active");
	
	});
	
	$j("#corporate-identity-design > h2 > a").mouseover(function(){
		
		$j("#corporate-identity-design > ul > li > h3 > a.portfolio-identity").stop().animate({height:'20px'},{queue:false, duration:1, easing: 'easeOutQuad'});
		
	});
	
	// Corporate Identity Design - Turn off this light and turn on home light
	
	$j("#corporate-identity-design").mouseout(function(){
	
		$j("#corporate-identity-design > h2 > a").removeClass("active");
		
		$j("#home > h2 > a").addClass("active");
	
	});
	
	// Corporate Identity Design - Slide out ul
	
	$j("#corporate-identity-design > h2 > a").mouseover(function(){
												   
		$j("#corporate-identity-design > ul").stop().animate({height:'94px'},{queue:false, duration:250, easing: 'easeOutQuad'})
	
	});
	
	// Corporate Identity Design - Slide in ul
	
	$j("#corporate-identity-design > h2 > a").mouseout(function(){
	
		$j("#corporate-identity-design > ul").stop().animate({height:'0px'},{queue:false, duration:250, easing: 'easeOutQuad'});
	
	});
	
	// Corporate Identity Design Sub Links - Stop ul from sliding back in
	
	$j("#corporate-identity-design > ul > li > h3 > a").mouseover(function(){
												   
		$j("#corporate-identity-design > ul").stop().animate({height:'94px'},{queue:false, duration:250, easing: 'easeOutQuad'})
	
	});
	
	// Corporate Identity Design Sub Links - Slide in ul
	
	$j("#corporate-identity-design > ul > li > h3 > a").mouseout(function(){
	
		$j("#corporate-identity-design > ul").stop().animate({height:'0px'},{queue:false, duration:250, easing: 'easeOutQuad'})
	
	});
	
	// Corporate Identity Design Sub Overview Link - Slide out
	
	$j("#corporate-identity-design > ul > li > h3 > a.overview").mouseover(function(){
												   
		$j("#corporate-identity-design > ul > li > h3 > a.portfolio-identity").stop().animate({height:'20px'},{queue:false, duration:250, easing: 'easeOutQuad'});
	
	});
	
	// Corporate Identity Design Sub Portfolio Link - Slide out
	
	$j("#corporate-identity-design > ul > li > h3 > a.portfolio-identity").mouseover(function(){
												   
		$j("#corporate-identity-design > ul > li > h3 > a.portfolio-identity").stop().animate({height:'106px'},{queue:false, duration:250, easing: 'easeOutQuad'});
		
		$j("#corporate-identity-design > ul").stop().animate({height:'180px'},{queue:false, duration:250, easing: 'easeOutQuad'});
	
	});
	
	// Corporate Identity Design Sub Prices Link - Slide out
	
	$j("#corporate-identity-design > ul > li > h3 > a.prices").mouseover(function(){
												   
		$j("#corporate-identity-design > ul > li > h3 > a.prices").stop().animate({height:'107px'},{queue:false, duration:250, easing: 'easeOutQuad'});
		
		$j("#corporate-identity-design > ul").stop().animate({height:'180px'},{queue:false, duration:250, easing: 'easeOutQuad'});
	
	});
	
	
	// Prices & Packages - Turn on this light and turn off home light
	
	$j("#prices").mouseover(function(){
	
		$j("#prices > h2 > a").addClass("active");
		
		$j("#home > h2 > a").removeClass("active");
	
	});
	
	// Prices & Packages - Turn off this light and turn on home light
	
	$j("#prices").mouseout(function(){
	
		$j("#prices > h2 > a").removeClass("active");
		
		$j("#home > h2 > a").addClass("active");
	
	});
	
	
	// Contact - Turn on this light and turn off home light
	
	$j("#contact").mouseover(function(){
	
		$j("#contact > h2 > a").addClass("active");
		
		$j("#home > h2 > a").removeClass("active");
	
	});
	
	// Contact - Turn off this light and turn on home light
	
	$j("#contact").mouseout(function(){
	
		$j("#contact > h2 > a").removeClass("active");
		
		$j("#home > h2 > a").addClass("active");
	
	});
	
	
});

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 trim(s)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not a whitespace, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (c != " ") returnString += c;
    }
    return returnString;
}
function stripCharsInBag(s, bag)
{   var i;
    var returnString = "";
    // Search through string's characters one by one.
    // If character is not in bag, append to returnString.
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character isn't whitespace.
        var c = s.charAt(i);
        if (bag.indexOf(c) == -1) returnString += c;
    }
    return returnString;
}

function checkInternationalPhone(strPhone){
var bracket=3
strPhone=trim(strPhone)
if(strPhone.indexOf("+")>1) return false
if(strPhone.indexOf("-")!=-1)bracket=bracket+1
if(strPhone.indexOf("(")!=-1 && strPhone.indexOf("(")>bracket)return false
var brchr=strPhone.indexOf("(")
if(strPhone.indexOf("(")!=-1 && strPhone.charAt(brchr+2)!=")")return false
if(strPhone.indexOf("(")==-1 && strPhone.indexOf(")")!=-1)return false
s=stripCharsInBag(strPhone,validWorldPhoneChars);
return (isInteger(s) && s.length >= minDigitsInIPhoneNumber);
}


function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Please include a valid E-mail Address")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Please include a valid E-mail Address")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Please include a valid E-mail Address")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Please include a valid E-mail Address")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Please include a valid E-mail Address")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Please include a valid E-mail Address")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Please include a valid E-mail Address")
		    return false
		 }

 		 return true					
	}


function checksubmit()

{if (document.enquire.Name.value == "")

{  alert("Please include your Name.")

  document.enquire.Name.focus()

  return false} 

  

var emailID=document.enquire.Email
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please include your E-mail Address")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.focus()
		return false
	}
	

var Phone=document.enquire.Phone
	
	if ((Phone.value==null)||(Phone.value=="")){
		alert("Please include your Phone Number")
		Phone.focus()
		return false
	}
	if (checkInternationalPhone(Phone.value)==false){
		alert("Please include a valid Phone Number")
		Phone.focus()
		return false
	}

  

  return true}