// JavaScript Document
//new rollover function! 
			function rollOverSwap (img){
				var string = $(img).attr('src');
				var regEx = /f1/;
				var newString = string.replace(regEx,"f2");
				$(img).attr('src',newString);
			}
			function rollOverBack (img){
				var string = $(img).attr('src');
				var regEx = /f2/;
				var newString = string.replace(regEx,"f1");
				$(img).attr('src',newString);
			}
			var cache = [];
		  	// Arguments are image paths relative to the current page.
		  	//auto pulls images
			function pullRollovers() {
				var imgArray = [];
				$('a > img').each(function(){
					var string = $(this).attr('src');
					var regEx = /f1/;
					var newString = string.replace(regEx,"f2");
					imgArray.push(newString);
				});
				var args_len = imgArray.length;
				for (var i = args_len; i--;) {
			 		 var cacheImage = document.createElement('img');
			 		 cacheImage.src = imgArray[i];
			 		 cache.push(cacheImage);
				}
		  	}
			function grayLoad(){
				var width = $(document).width();
				width = width - 955;
				width = width / 2;
				width = width + 192;
				$('#topObjSet2').width(width);
			}

			//ajax login			
			function ajaxDown(){
					$('#topObjSet2').animate({height:150, backgroundColor:'#759eb3'},"slow");
					$('#loginDiv').fadeIn();
				}
				function ajaxUp(){
					$('#loginDiv').fadeOut();
					$('#topObjSet2').animate({height:25, backgroundColor:'#898989'},"slow");
				}
			function ajaxLogin (){
				grayLoad();
				$('#login').click(function(){
					if($('#topObjSet2').height() > 25){
						ajaxUp();
					}else{
						ajaxDown();
					}
				});
				$('#ajaxClick').click(function(){
					$.ajax({
						type: "POST",
						url: "php/login.php",
						dataType: "json",
						data: "userName="+$('#userName').val()+"&password="+$('#password').val(),
						success: function(data) {
							$('#loginDiv').fadeOut();
							$('#topObjSet2').animate({height:25, backgroundColor:data.color1},"slow");
							var html = '<p style="color:'+data.color2+';">Welcome '+data.userName+' <a href="php/logout.php" style=color:'+data.color2+'; font-size:12px; font-weight:bold;">(logout)</a> | <a href="contact.html" style="color:'+data.color2+'; font-size:12px; font-weight:bold;">Contact Us</a></p>';
							$('#barText').html(html);
						},
						error: function(data) {
							alert("username password incorect");
						}
					});
				});
			}
			function barMover(div1,div2,left,width){
				$(div1).find('a').mouseenter(function (e) {
					var a=$(this);
  					var position = $(this).position();
					  e.stopPropagation();
					  $(div2).stop().animate({"left":position.left+4, "width":a.innerWidth()},500,"easeInOutBack");
					});
				$(div1).mouseleave(function(){
					$(div2).stop().animate({'left':left, 'width':width},500,"easeInOutBack");
				});
			};

			function writeImage(pic, number){
				document.getElementById(pic).src=display[number];
			}
			//These are master functions for each page

			//index page master function
		function indexMaster(){
			barMover('#linksObj','#menu_underline',4,33)
				barMover('#subObj8','#underline',4,33)
				$('#web').click(function(){
					$('#subObj2').animate({top:45},500,"easeInOutBack");
					$('#identitycycle1').css('display','none');
					$('#identitycycle2').css('display','none');
					$('#mediacycle1').css('display','none');
					$('#mediacycle2').css('display','none');
					$('#websitecycle1').fadeIn(400);
					$('#websitecycle2').fadeIn(400);					
				});
				$('#identity').click(function(){
					$('#subObj2').animate({top:64},500,"easeInOutBack");
					$('#websitecycle1').css('display','none');
					$('#websitecycle2').css('display','none');
					$('#mediacycle1').css('display','none');
					$('#mediacycle2').css('display','none');
					$('#identitycycle1').fadeIn(400);
					$('#identitycycle2').fadeIn(400);	
				});
				$('#media').click(function(){
					$('#subObj2').animate({top:83},500,"easeInOutBack");
					$('#identitycycle1').css('display','none');
					$('#identitycycle2').css('display','none');
					$('#websitecycle1').css('display','none');
					$('#websitecycle2').css('display','none');
					$('#mediacycle1').fadeIn(400);
					$('#mediacycle2').fadeIn(400);	
				});
				$('#infoAbout').click(function(){
					barMover('#subObj8','#underline',4,33);
					$('#subObj9').animate({height:0, width:0},600,"swing", function(){
						$('#subObj9').html('<p style="position:absolute; top:7px; left:10px; width:440px;">CyNet Design, Inc. provides expert knowledge in corporate branding and marketing in both digital and print media. We specialize in logo development, web design and development, and any print marketing you could need. We are experts at designing brochures, magazine and newspaper advertising, mailers, email advertising, business cards, data sheets and booth designs and materials for trade shows. We can build a brand image to establish or improve your company. CyNet Design, Inc. is located in Douglas County, Colorado but provides services throughout the United States.</p>')
					});
					$('#subObj9').animate({height:155, width:460},600,"swing");
				});
				$('#infoClients').click(function(){
					barMover('#subObj8','#underline',55,64)
					$('#subObj9').animate({height:0, width:0},600,"swing", function(){
						$('#subObj9').html('<p style="position:absolute; top:7px; left:10px; width:440px;">CyNet Design, Inc. Community Support:<br>We are committed to supporting the following groups in our community:<br><br><a href="http://www.chicksforcharity.org" target="_blank"><img src="images/community_chicks.png"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.dclivingtoysfortots.com" target="_blank"><img src="images/community_toys.png"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.playgroundensemble.com" target="_blank"><img src="images/community_playground.png"></a></p>')
					});
					$('#subObj9').animate({height:155, width:460},600,"swing");
				});
				$('#infoDomain').click(function(){
					barMover('#subObj8','#underline',137,112)
					$('#subObj9').animate({height:0, width:0},600,"swing", function(){
						$('#subObj9').html('<p style="position:absolute; top:7px; left:10px; width:440px;"><a href="http://cynetdomains.com" target="_blank"><img src="images/domains_header.png"></a><br><br>Purchase a domain name for your company, group or family starting at $8.75 for .com domain name!<br><br><a href="http://cynetdomains.com" target="_blank">CLICK HERE FOR CYNETDOMAINS.COM!</a></p>')
					});
					$('#subObj9').animate({height:155, width:460},600,"swing");
				});
				$('#cynetIndex').fadeIn(1500,function(){
					autoScroller('scroller',1);
				});
				$(document).ready(function() {
					$('.slideshow').cycle({
						fx: 'fade'
					});
				});
			}


			//websites master function
			function websitesMaster(){
				pullRollovers();
				$('a > img').mouseenter(function(){
					rollOverSwap(this);
				});
				$('a > img').mouseleave(function(){
					rollOverBack(this);
				});
				barMover('#linksObj','#menu_underline',58,103)
				$('#current').click(function(){
					var identify=display[2];
					var regExp1 = /images\/array_/;
					var regExp2 = /.png/;
					var pull1 = identify.replace(regExp1,"");
					var pull = pull1.replace(regExp2,"");
					$('#' + pull).css('display','none');
					display = current;
					var identify=display[2];
							var regExp1 = /images\/array_/;
							var regExp2 = /.png/;
							var pull1 = identify.replace(regExp1,"");
							var pull = pull1.replace(regExp2,"");
							$('#' + pull).css('display','block');
							writeImage('pic0',0);
							writeImage('pic1',1);
							writeImage('pic2',2);
							writeImage('pic3',3);
							writeImage('pic4',4);
					$('#projects_underline').animate({left:120, width:90},500,"easeInOutBack");
				});

				$('#completed').click(function(){
					var identify=display[2];
					var regExp1 = /images\/array_/;
					var regExp2 = /.png/;
					var pull1 = identify.replace(regExp1,"");
					var pull = pull1.replace(regExp2,"");
					$('#' + pull).css('display','none');
					display = completed;
						var identify=display[2];
						var regExp1 = /images\/array_/;
						var regExp2 = /.png/;
						var pull1 = identify.replace(regExp1,"");
						var pull = pull1.replace(regExp2,"");
						$('#' + pull).css('display','block');
						writeImage('pic0',0);
						writeImage('pic1',1);
						writeImage('pic2',2);
						writeImage('pic3',3);
						writeImage('pic4',4);
					$('#projects_underline').animate({left:0, width:109},500,"easeInOutBack");
				});
				$('#left').click(function(){
					var identify=$('#pic2').attr('src');
					var regExp1 = /images\/array_/;
					var regExp2 = /.png/;
					var pull1 = identify.replace(regExp1,"");
					var pull = pull1.replace(regExp2,"");
					$('#' + pull).css('display','none');					
					$('#img1').animate({"left":"-=283px", opacity:0},600,"swing",
						function(){
							$(this).css('display', 'none');
						});
					$('#img2').animate({"left":"-=283px"},600);
					$('#img3').animate({"left":"-=283px"},600);
					$('#img4').css('display', 'block');
					$('#img4').animate({"left":"-=283px"},600,"swing",
						function(){
							$('#img4').css('filter',null);
							display.push(display[0]);
							display.shift();
							$('#img0').css('left','-283px');
							document.getElementById('pic0').src=display[0];
							$('#img1').css('left','0px');
							$('#img1').css('display','block');
							$('#img1').css('opacity','1');
							$('#img1').css('filter',null);
							document.getElementById('pic1').src=display[1];
							$('#img2').css('left','283px');
							document.getElementById('pic2').src=display[2];
							$('#img3').css('left','566px');
							document.getElementById('pic3').src=display[3];
							$('#img4').css('left','849px');
							$('#img4').css('display','none');
							document.getElementById('pic4').src=display[4];
							var identify=$('#pic2').attr('src');
							var regExp1 = /images\/array_/;
							var regExp2 = /.png/;
							var pull1 = identify.replace(regExp1,"");
							var pull = pull1.replace(regExp2,"");
							$('#' + pull).css('display','block');
						});				
				});
				$('#right').click(function(){
					var identify=$('#pic2').attr('src');
					var regExp1 = /images\/array_/;
					var regExp2 = /.png/;
					var pull1 = identify.replace(regExp1,"");
					var pull = pull1.replace(regExp2,"");
					$('#' + pull).css('display','none');
					$('#img0').animate({"left":"+=283px"},600,"swing");
					$('#img0').css('display', 'block');
					$('#img1').animate({"left":"+=283px"},600);
					$('#img2').animate({"left":"+=283px"},600);
					$('#img3').animate({"left":"+=283px", opacity:0},600,"swing",
						function(){
							display.unshift(display[display.length-1]);
							display.pop();
							$('#img0').css('left','-283px');
							$('#img0').css('display','none');
							document.getElementById('pic0').src=display[0];
							$('#img1').css('left','0px');
							document.getElementById('pic1').src=display[1];
							$('#img2').css('left','283px');
							document.getElementById('pic2').src=display[2];
							$('#img3').css('left','566px');
							$('#img3').css('opacity','1');
							$('#img3').css('filter',null);
							document.getElementById('pic3').src=display[3];
							$('#img4').css('left','849px');
							$('#img4').css('display','none');
							document.getElementById('pic4').src=display[4];
							var identify=$('#pic2').attr('src');
							var regExp1 = /images\/array_/;
							var regExp2 = /.png/;
							var pull1 = identify.replace(regExp1,"");
							var pull = pull1.replace(regExp2,"");
							$('#' + pull).css('display','block');
						});
				});
				$('#cynetWebsites').fadeIn(1500);
			}

			//identity master function
			function identiyMaster (){
				pullRollovers();
				$('a > img').mouseenter(function(){
					rollOverSwap(this);
				});
				$('a > img').mouseleave(function(){
					rollOverBack(this);
				});
				barMover('#linksObj','#menu_underline',182,120)
				$('#current').click(function(){
					$('#projects_underline').animate({left:120, width:90},500,"easeInOutBack");
				});
				$('#completed').click(function(){
					$('#projects_underline').animate({left:0, width:109},500,"easeInOutBack");
				});
				$('#up').click(function(){
					var identify=$('#pic1').attr('src');
					var regExp1 = /images\/identity_array_/;
					var regExp2 = /.png/;
					var pull1 = identify.replace(regExp1,"");
					var pull = pull1.replace(regExp2,"");
					$('#' + pull).css('display','none');					
					$('#img1').animate({"top":"-=91px", opacity:0},500,"swing",
						function(){
							$(this).css('display', 'none');
						});
					$('#img2').animate({"top":"-=91px"},500);
					$('#img3').animate({"top":"-=91px"},500);
					$('#img4').animate({"top":"-=91px"},500);
					$('#img5').css('display', 'block');
					$('#img5').animate({"top":"-=91px", opacity:1},500,"swing",
						function(){
							pics.push(pics[0]);
							pics.shift();
							$('#img0').css('top','-91px');
							document.getElementById('pic0').src=pics[0];
							$('#img1').css('top','0px');
							$('#img1').css('display','block');
							$('#img1').css('opacity','1');
							document.getElementById('pic1').src=pics[1];
							$('#img2').css('top','91px');
							document.getElementById('pic2').src=pics[2];
							$('#img3').css('top','182px');
							document.getElementById('pic3').src=pics[3];
							$('#img4').css('top','273px');
							document.getElementById('pic4').src=pics[4];
							$('#img5').css('top','364px');
							$('#img5').css('display','none');
							document.getElementById('pic5').src=pics[5];
							var identify=$('#pic1').attr('src');
							var regExp1 = /images\/identity_array_/;
							var regExp2 = /.png/;
							var pull1 = identify.replace(regExp1,"");
							var pull = pull1.replace(regExp2,"");
							$('#' + pull).css('display','block');
						});				
				});
				$('#down').click(function(){
					var identify=$('#pic1').attr('src');
					var regExp1 = /images\/identity_array_/;
					var regExp2 = /.png/;
					var pull1 = identify.replace(regExp1,"");
					var pull = pull1.replace(regExp2,"");
					$('#' + pull).css('display','none');
					$('#img0').animate({"top":"+=91px", opacity:1},500,"swing");
					$('#img0').css('display', 'block');
					$('#img1').animate({"top":"+=91px"},500);
					$('#img2').animate({"top":"+=91px"},500);
					$('#img3').animate({"top":"+=91px"},500);
					$('#img4').animate({"top":"+=91px", opacity:0},500,"swing",
						function(){
							pics.unshift(pics[pics.length-1]);
							pics.pop();
							$('#img0').css('top','-91px');
							$('#img0').css('display','none');
							document.getElementById('pic0').src=pics[0];
							$('#img1').css('top','0px');
							document.getElementById('pic1').src=pics[1];
							$('#img2').css('top','91px');
							document.getElementById('pic2').src=pics[2];
							$('#img3').css('top','182px');
							document.getElementById('pic3').src=pics[3];
							$('#img4').css('top','273px');
							$('#img4').css('opacity','1');
							document.getElementById('pic4').src=pics[4];
							$('#img5').css('top','364px');
							$('#img5').css('display','none');
							document.getElementById('pic5').src=pics[5];
							var identify=$('#pic1').attr('src');
							var regExp1 = /images\/identity_array_/;
							var regExp2 = /.png/;
							var pull1 = identify.replace(regExp1,"");
							var pull = pull1.replace(regExp2,"");
							$('#' + pull).css('display','block');
						});
				});
				$('#cynetWebsites').fadeIn(1500);
			}

			//services master
			function servicesMaster(){
				var icons = {
					header: "ui-icon-circle-arrow-e",
					headerSelected: "ui-icon-circle-arrow-s"
				};
				$("#accordion").accordion({
					icons: icons,
					autoHeight: false,
					navigation: true
				});
				barMover('#linksObj','#menu_underline',548,50);
				$('#cynetServices').fadeIn(1500);
			}
			
			
			//proccess master 
			function processMaster(){
				var icons = {
					header: "ui-icon-circle-arrow-e",
					headerSelected: "ui-icon-circle-arrow-s"
				};
				$("#accordion").accordion({
					icons: icons,
					autoHeight: false,
					navigation: true
				});
				barMover('#linksObj','#menu_underline',619,48);
				$('#cynetServices').fadeIn(1500)
			}
			
			//Staff Master
			function staffMaster(){
					barMover('#linksObj','#menu_underline',688,27);
				/*
				$('#todd').click(function(){
					$('#subObj4').animate({height:0, width:0, 'left':"+=280px"},600,"swing", function(){
						$(this).html($('#toddhtml').html());
					});
					$('#subObj4').animate({height:315, width:280, 'left':"-=280px"},600,"swing");
				});
				$('#david').click(function(){
					$('#subObj4').animate({height:0, width:0, 'left':"+=280px", 'top':'+=40px'},600,"swing", function(){
						$(this).html($('#davidhtml').html());
					});
					$('#subObj4').animate({height:315, width:280, 'left':"-=280px", 'top':'-=40px'},600,"swing");
				});
				$('#les').click(function(){
					$('#subObj4').animate({height:0, width:0, 'left':"+=280px", 'top':'+=80px'},600,"swing", function(){
						$(this).html($('#leshtml').html());
					});
					$('#subObj4').animate({height:315, width:280, 'left':"-=280px", 'top':'-=80px'},600,"swing");
				});
				$('#awesome').click(function(){
					$('#subObj4').animate({height:0, width:0, 'left':"+=280px", 'top':'+=120px'},600,"swing", function(){
						$(this).html($('#benhtml').html());
					});
					$('#subObj4').animate({height:315, width:280, 'left':"-=280px", 'top':'-=120px'},600,"swing");
				});
				$('#tim').click(function(){
					$('#subObj4').animate({height:0, width:0, 'left':"+=280px", 'top':'+=160px'},600,"swing", function(){
						$(this).html($('#timhtml').html());
					});
					$('#subObj4').animate({height:315, width:280, 'left':"-=280px", 'top':'-=160px'},600,"swing");
				});
				$('#susan').click(function(){
					$('#subObj4').animate({height:0, width:0, 'left':"+=280px", 'top':'+=190px'},600,"swing", function(){
						$(this).html($('#susanhtml').html());
					});
					$('#subObj4').animate({height:315, width:280, 'left':"-=280px", 'top':'-=190px'},600,"swing");
				});
				$('#bill').click(function(){
					$('#subObj4').animate({height:0, width:0, 'left':"+=280px", 'top':'+=235px'},600,"swing", function(){
						$(this).html($('#billhtml').html());
					});
					$('#subObj4').animate({height:315, width:280, 'left':"-=280px", 'top':'-=235px'},600,"swing");
				});
				*/
				$('#cynetServices').fadeIn(1500);
			}
			//Media page Master
			function mediaMaster (){
				pullRollovers();
				$('a > img').mouseenter(function(){
					rollOverSwap(this);
				});
				$('a > img').mouseleave(function(){
					rollOverBack(this);
				});
				barMover('#linksObj','#menu_underline',323,130);
				function brochurehtml(){
					$('#brochure').click(function(){
						$('#examples').animate({height:0,width:0},800,"swing",
							function(){	
								$('#examples').html($('#exbrochures').html());						
								$('#examples').animate({height:620,width:560},800,"swing");
							}
						);
					});
				};
				brochurehtml();
				function adshtml(){
					$('#ads').click(function(){
						$('#examples').animate({height:0,width:0},800,"swing",
							function(){	
								$('#examples').html($('#exads').html());						
								$('#examples').animate({height:620,width:560},800,"swing");
							}
						);
					});
				};
				function mailerhtml(){
					$('#mailer').click(function(){
						$('#examples').animate({height:0,width:0},800,"swing",
							function(){	
								$('#examples').html($('#exmailers').html());						
								$('#examples').animate({height:620,width:560},800,"swing");
							}
						);
					});
				};
				function saleshtml(){
					$('#sales').click(function(){
						$('#examples').animate({height:0,width:0},800,"swing",
							function(){	
								$('#examples').html($('#exsales').html());						
								$('#examples').animate({height:620,width:560},800,"swing");
							}
						);
					});
				};
				function emailhtml(){
					$('#email').click(function(){
						$('#examples').animate({height:0,width:0},800,"swing",
							function(){	
								$('#examples').html($('#exemail').html());						
								$('#examples').animate({height:620,width:560},800,"swing");
							}
						);
					});
				};
				function trifoldhtml(){
					$('#trifold').click(function(){
						$('#examples').animate({height:0,width:0},800,"swing",
							function(){	
								$('#examples').html($('#extrifolds').html());						
								$('#examples').animate({height:620,width:560},800,"swing");
							}
						);
					});
				};
				trifoldhtml();
				$('#up').click(function(){					
					$("#cycle1").animate({"top":"-160px"},500,"swing");
					$('#cycle1').css('display', 'none');
					$("#cycle2").animate({"top":"0px"},500);
					$("#cycle3").css('display','block');
					$("#cycle3").animate({"top":"160px"},500,"swing",
						function(){
							divs.push(divs[0]);
							divs.shift();
							$("#cycle0").css('top','-160px');
							$("#cycle0").html($(divs[0]).html());
							$("#cycle1").css('top','0px');
							$("#cycle1").css('display','block');
							$("#cycle1").html($(divs[1]).html());
							$("#cycle2").css('top','160px');
							$("#cycle2").html($(divs[2]).html());
							$("#cycle3").css('top','320px');
							$("#cycle3").css('display','none');
							$("#cycle3").html($(divs[3]).html());
							brochurehtml();
							trifoldhtml();
							adshtml();
							mailerhtml();
							saleshtml();
							emailhtml();
							pullRollovers();
							$('a > img').mouseenter(function(){
								rollOverSwap(this);
							});
							$('a > img').mouseleave(function(){
								rollOverBack(this);
							});
						});
				});
				$('#down').click(function(){
					$("#cycle0").css('display', 'block');
					$("#cycle0").animate({"top":"0px"},500,"swing");
					$("#cycle1").animate({"top":"160px"},500);
					$('#cycle2').css('display','none');
					$("#cycle2").animate({"top":"320px"},500,"swing",
						function(){
							divs.unshift(divs[divs.length-1]);
							divs.pop();
							$("#cycle0").css('top','-160px');
							$("#cycle0").css('display','none');
							$("#cycle0").html($(divs[0]).html());
							$("#cycle1").css('top','0px');
							$("#cycle1").html($(divs[1]).html());
							$("#cycle2").css('top','160px');
							$("#cycle2").css('display','block');
							$("#cycle2").html($(divs[2]).html());
							$("#cycle3").css('top','320px');
							$("#cycle3").css('display','none');
							$("#cycle3").html($(divs[3]).html());
							brochurehtml();
							trifoldhtml();
							adshtml();
							mailerhtml();
							saleshtml();
							emailhtml();
							pullRollovers();
							$('a > img').mouseenter(function(){
								rollOverSwap(this);
							});
							$('a > img').mouseleave(function(){
								rollOverBack(this);
							});
						});
				});
			}
			
			//Default page Master
			function defaultMaster (){
				barMover('#linksObj','#menu_underline',4,0)
				$('#cynetIndex').fadeIn(1500);
				$('#login').toggle(function(){
					$('#topObjSet2').animate({height:150, backgroundColor:'#759eb3'},"slow");
					$('#loginDiv').fadeIn();
				},function(){
					$('#loginDiv').fadeOut();
					$('#topObjSet2').animate({height:25, backgroundColor:'#898989'},"slow");
				});
				$('#ajaxClick').click(function(){
					$.ajax({
						type: "POST",
						url: "login.php",
						dataType: "json",
						data: "userName="+$('#userName').val()+"&password="+$('#password').val(),
						success: function(data) {
							$('#loginDiv').fadeOut();
							$('#topObjSet2').animate({height:25, backgroundColor:'#3e7998'},"slow");
							var html = 'Welcome '+data.userName+' | <a href="contact.html" style="color:#ffffff; font-size:12px; font-weight:bold;">Contact Us</a>';
							$('#barText').html(html);
						},
						error: function(data) {
							alert("username password incorect");
						}
					});
				});
			}
