var dimages=new Array();
var numImages= 1;
for (i=0; i<numImages; i++)
{
  dimages[i]=new Image();
  dimages[i].src="slideshow/"+(i+1)+".jpg";
}
var curImage=-1;
function swapPicture()
{
  if (document.images)
  {
    var nextImage=curImage+1;
    if (nextImage>=numImages)
      nextImage=0;
    if (dimages[nextImage] && dimages[nextImage].complete)
    {
      var target=0;
      if (document.images.ssimage)
        target=document.images.ssimage;
      if (document.all && document.getElementById("ssimage"))
        target=document.getElementById("ssimage");
  
      // make sure target is valid.  It might not be valid
      //   if the page has not finished loading
      if (target)
      {
        target.src=dimages[nextImage].src;
        curImage=nextImage;
      }
      setTimeout("swapPicture()", 2000);
    }
    else
    {
      setTimeout("swapPicture()", 2000);
    }
  }
}
setTimeout("swapPicture()", 2000);
function byid(e) { return document.getElementById(e); }
function sitemode(what){
	if (what=='gall'){
		jQuery("#leftside").hide();
		jQuery("#rightside").hide();
		jQuery("#gallside").show();
		jQuery("#gallnav").show();
//		CSBfleXcroll('mycustomscroll3');
	} else if (what=='cols'){
		jQuery("#leftside").show();
		jQuery("#rightside").show();
		jQuery("#gallside").hide();
		jQuery("#gallnav").hide();
//		CSBfleXcroll('mycustomscroll');
//		CSBfleXcroll('mycustomscroll2');
	}
}
function settitle(t){
	if (document.title != 'The Big Chandelier - '+t) {
		document.title = 'The Big Chandelier - '+t;	
}}
function setimgtitle(timg){
	if (byid('pagetitle').style.background != 'url(images/titles/'+timg+')') {
		byid('pagetitle').style.background = 'url(images/titles/'+timg+')';
}}

function compproj(category,th_page){
		jQuery.get("showgall3.php", { cat: category, th_page: th_page }, function(data){
			jQuery("#leftcontent2").html(data);
			jQuery("#didiyleoba3").html("&nbsp;");
			sitemode('gall');
		});
}
function compprojrand(cat){
		jQuery.get("showgall4.php", { cat: cat }, function(data){
			jQuery("#leftcontent2").html(data);
			jQuery("#didiyleoba3").html("&nbsp;");
			sitemode('gall');
		});
}
function loadrandgall(product,th_page){
		jQuery.get("showgallrand.php", { prod: product, th_page: th_page }, function(data){
			jQuery("#leftcontent2").html(data);
			jQuery("#didiyleoba3").html("&nbsp;");
			//skin("mycustomscroll3");
//			byid("mycustomscroll3").scrollUpdate();
		});
}
function loadfrommenu(product){
		jQuery.get("listlinks2.php", { prod: product }, function(data){
			jQuery("#gallnav").html(data); });
		sitemode('gall');
		loadrandgall(product,0);
		jQuery("#didiyleoba3").html("&nbsp;");
		
		
		fleXcrollTo("mycustomscroll2","0px","1px",false);
}


function loadfirst(product){
		jQuery.get("listlinks2.php", { prod: product }, function(data){
			jQuery("#gallnav").html(data); });
		sitemode('gall');
		loadgall(product, 'iron', 0);
		jQuery("#didiyleoba3").html("&nbsp;");
		
		
		fleXcrollTo("mycustomscroll2","0px","1px",false);
}


function loadgall(product,category, th_page){
		jQuery.get("showgall2.php", { prod: product, cat: category, th_page: th_page }, function(data){
			jQuery("#leftcontent2").html(data);
			jQuery("#didiyleoba3").html("&nbsp;");

		});
}




function indprodcat(prodcat) {
	var color1 = '#B06441';
	var color2 = '#6B350F';
	switch(prodcat) {
		case 'iron':
			byid('nav_iron').style.color = color2;
			byid('nav_wood').style.color = color1;
			byid('nav_bronze').style.color = color1;
			byid('nav_nickelsilver').style.color = color1;
			byid('nav_crystal').style.color = color1;
			byid('nav_other').style.color = color1;
			///////////////
			byid('nav_iron').style.fontStyle = 'italic';
			byid('nav_wood').style.fontStyle = 'normal';
			byid('nav_bronze').style.fontStyle = 'normal';
			byid('nav_nickelsilver').style.fontStyle = 'normal';
			byid('nav_crystal').style.fontStyle = 'normal';
			byid('nav_other').style.fontStyle = 'normal';
		break;    
		case 'wood':
			byid('nav_iron').style.color = color1;
			byid('nav_wood').style.color = color2;
			byid('nav_bronze').style.color = color1;
			byid('nav_nickelsilver').style.color = color1;
			byid('nav_crystal').style.color = color1;
			byid('nav_other').style.color = color1;
			///////////////
			byid('nav_iron').style.fontStyle = 'normal';
			byid('nav_wood').style.fontStyle = 'italic';
			byid('nav_bronze').style.fontStyle = 'normal';
			byid('nav_nickelsilver').style.fontStyle = 'normal';
			byid('nav_crystal').style.fontStyle = 'normal';
			byid('nav_other').style.fontStyle = 'normal';
		break;
		case 'bronze':
			byid('nav_iron').style.color = color1;
			byid('nav_wood').style.color = color1;
			byid('nav_bronze').style.color = color2;
			byid('nav_nickelsilver').style.color = color1;
			byid('nav_crystal').style.color = color1;
			byid('nav_other').style.color = color1;
			///////////////
			byid('nav_iron').style.fontStyle = 'normal';
			byid('nav_wood').style.fontStyle = 'normal';
			byid('nav_bronze').style.fontStyle = 'italic';
			byid('nav_nickelsilver').style.fontStyle = 'normal';
			byid('nav_crystal').style.fontStyle = 'normal';
			byid('nav_other').style.fontStyle = 'normal';
		break;
		case 'nickelsilver':
			byid('nav_iron').style.color = color1;
			byid('nav_wood').style.color = color1;
			byid('nav_bronze').style.color = color1;
			byid('nav_nickelsilver').style.color = color2;
			byid('nav_crystal').style.color = color1;
			byid('nav_other').style.color = color1;
			///////////////
			byid('nav_iron').style.fontStyle = 'normal';
			byid('nav_wood').style.fontStyle = 'normal';
			byid('nav_bronze').style.fontStyle = 'normal';
			byid('nav_nickelsilver').style.fontStyle = 'italic';
			byid('nav_crystal').style.fontStyle = 'normal';
			byid('nav_other').style.fontStyle = 'normal';
		break;
		case 'crystal':
			byid('nav_iron').style.color = color1;
			byid('nav_wood').style.color = color1;
			byid('nav_bronze').style.color = color1;
			byid('nav_nickelsilver').style.color = color1;
			byid('nav_crystal').style.color = color2;
			byid('nav_other').style.color = color1;
			///////////////
			byid('nav_iron').style.fontStyle = 'normal';
			byid('nav_wood').style.fontStyle = 'normal';
			byid('nav_bronze').style.fontStyle = 'normal';
			byid('nav_nickelsilver').style.fontStyle = 'normal';
			byid('nav_crystal').style.fontStyle = 'italic';
			byid('nav_other').style.fontStyle = 'normal';
		break;
		case 'other':
			byid('nav_iron').style.color = color1;
			byid('nav_wood').style.color = color1;
			byid('nav_bronze').style.color = color1;
			byid('nav_nickelsilver').style.color = color1;
			byid('nav_crystal').style.color = color1;
			byid('nav_other').style.color = color2;
			///////////////
			byid('nav_iron').style.fontStyle = 'normal';
			byid('nav_wood').style.fontStyle = 'normal';
			byid('nav_bronze').style.fontStyle = 'normal';
			byid('nav_nickelsilver').style.fontStyle = 'normal';
			byid('nav_crystal').style.fontStyle = 'normal';
			byid('nav_other').style.fontStyle = 'italic';
		break;
	}
}

function indprodcat2(prodcat) {
	var color1 = '#B06441';
	var color2 = '#6B350F';
	switch(prodcat) {
		case 'chandeliers':
			byid('nav_chandeliers').style.color = color2;
			byid('nav_sconces').style.color = color1;
			byid('nav_lanterns').style.color = color1;
			byid('nav_lamps').style.color = color1;
			byid('nav_other').style.color = color1;
			///////////////
			byid('nav_chandeliers').style.fontStyle = 'italic';
			byid('nav_sconces').style.fontStyle = 'normal';
			byid('nav_lanterns').style.fontStyle = 'normal';
			byid('nav_lamps').style.fontStyle = 'normal';
			byid('nav_other').style.fontStyle = 'normal';
	
		break;    
		case 'sconces':
			byid('nav_chandeliers').style.color = color1;
			byid('nav_sconces').style.color = color2;
			byid('nav_lanterns').style.color = color1;
			byid('nav_lamps').style.color = color1;
			byid('nav_other').style.color = color1;

			///////////////
			byid('nav_chandeliers').style.fontStyle = 'normal';
			byid('nav_sconces').style.fontStyle = 'italic';
			byid('nav_lanterns').style.fontStyle = 'normal';
			byid('nav_lamps').style.fontStyle = 'normal';
			byid('nav_other').style.fontStyle = 'normal';

		break;
		case 'lanterns':
			byid('nav_chandeliers').style.color = color1;
			byid('nav_sconces').style.color = color1;
			byid('nav_lanterns').style.color = color2;
			byid('nav_lamps').style.color = color1;
			byid('nav_other').style.color = color1;

			///////////////
			byid('nav_chandeliers').style.fontStyle = 'normal';
			byid('nav_sconces').style.fontStyle = 'normal';
			byid('nav_lanterns').style.fontStyle = 'italic';
			byid('nav_lamps').style.fontStyle = 'normal';
			byid('nav_other').style.fontStyle = 'normal';
	
		break;
		case 'lamps':
			byid('nav_chandeliers').style.color = color1;
			byid('nav_sconces').style.color = color1;
			byid('nav_lanterns').style.color = color1;
			byid('nav_lamps').style.color = color2;
			byid('nav_other').style.color = color1;

			///////////////
			byid('nav_chandeliers').style.fontStyle = 'normal';
			byid('nav_sconces').style.fontStyle = 'normal';
			byid('nav_lanterns').style.fontStyle = 'normal';
			byid('nav_lamps').style.fontStyle = 'italic';
			byid('nav_other').style.fontStyle = 'normal';

		break;
		case 'other':
			byid('nav_chandeliers').style.color = color1;
			byid('nav_sconces').style.color = color1;
			byid('nav_lanterns').style.color = color1;
			byid('nav_lamps').style.color = color1;
			byid('nav_other').style.color = color2;
	
			///////////////
			byid('nav_chandeliers').style.fontStyle = 'normal';
			byid('nav_sconces').style.fontStyle = 'normal';
			byid('nav_lanterns').style.fontStyle = 'normal';
			byid('nav_lamps').style.fontStyle = 'normal';
			byid('nav_other').style.fontStyle = 'italic';

		break;
	
	}
}
function prodpop(product,category,id){
//	window.open("prodpopup.php?prod="+product+"&cat="+category+"&id="+id, "Product Details",",scrollbars,scrollbars,resizable,height=600,width=800");
	MM_openBrWindow("prodpopup.php?prod="+product+"&cat="+category+"&id="+id+"", "Product_Details","scrollbars=yes,resizable=no,height=600,width=880");
	return false;
}
function comppop(category,id){
//	window.open("comppopup.php?id="+id, "Completed Projects Details",",scrollbars,scrollbars,resizable,height=600,width=800");
	MM_openBrWindow("comppopup.php?cat="+category+"&id="+id+"", "Completed_Projects_Details","scrollbars=yes,resizable=no,height=600,width=800");
	return false;
}
jQuery(document).ready(function(){//////////
//	alert(byid('slideshownumb').innerHTML);
	jQuery("#pagination").hide();
	jQuery("#pagination2").hide();
	sitemode('cols');
	if (jQuery("#contentarea").empty()) {//Load Default Page
		setimgtitle('mainpage.png');
		jQuery.get("loadc.php", { file: "mainpage", type: "content" }, function(data){
			jQuery("#contentarea").html(data);
			fleXcrollTo("mycustomscroll2","1px","1px",false);
			CSBfleXcroll("mycustomscroll2");
			jQuery("#didiyleoba").html("&nbsp;");
		
		});
		jQuery.get("loadc.php", { file: "mainpage", type: "title" }, function(data){
			settitle(data); });
			
	}
	if (jQuery("#leftcontent").empty()) {//Load Default Left Area Content
		jQuery.get("slideshow.php", function(data){
			jQuery("#leftcontent").html(data);
			jQuery("#didiyleoba2").html("&nbsp;");
		//	CSBfleXcroll('mycustomscroll2');
			fleXcrollTo("mycustomscroll2","1px","1px",false);
			
		});
	}
/*	if (jQuery("#leftcontent2").empty()) {
		jQuery.get("empty.php", function(data){
			jQuery("#leftcontent2").html(data);
			jQuery("#didiyleoba3").html("&nbsp;");
			CSBfleXcroll('mycustomscroll3');
		});
	}*/
	jQuery("#homeicon").click(function(){//Home Icon
		setimgtitle('mainpage.png');
		jQuery.get("loadc.php", { file: "mainpage", type: "content" }, function(data){
			jQuery("#contentarea").html(data);
			fleXcrollTo("mycustomscroll2","1px","1px",false);
			CSBfleXcroll("mycustomscroll2");
			jQuery("#didiyleoba").html("&nbsp;");
	
		});
		jQuery.get("loadc.php", { file: "mainpage", type: "title" }, function(data){
			settitle(data); });
		jQuery.get("slideshow.php", function(data){
			jQuery("#leftcontent").html(data);
		});
		sitemode('cols');
	});
	
	jQuery("#fuckoff").click(function(){//Home Icon
		setimgtitle('mainpage.png');
		jQuery.get("loadc.php", { file: "mainpage", type: "content" }, function(data){
			jQuery("#contentarea").html(data);
			fleXcrollTo("mycustomscroll2","1px","1px",false);
			CSBfleXcroll("mycustomscroll2");
			jQuery("#didiyleoba").html("&nbsp;");
			
		});
		jQuery.get("loadc.php", { file: "mainpage", type: "title" }, function(data){
			settitle(data); });
		jQuery.get("slideshow.php", function(data){
			jQuery("#leftcontent").html(data);
		});
		sitemode('cols');
	//	fleXcrollTo("mycustomscroll2","100px","1px",false);
	});
	jQuery("#nav_mainpage").click(function(){
		setimgtitle('mainpage.png');
		jQuery.get("loadc.php", { file: "mainpage", type: "content" }, function(data){
			jQuery("#contentarea").html(data);
			fleXcrollTo("mycustomscroll2","1px","1px",false);
			CSBfleXcroll("mycustomscroll2");
			jQuery("#didiyleoba").html("&nbsp;");
			
		});
		jQuery.get("loadc.php", { file: "mainpage", type: "title" }, function(data){
			settitle(data); });
		jQuery.get("slideshow.php", function(data){
			jQuery("#leftcontent").html(data); });
		sitemode('cols');
	});
	jQuery("#nav_process").click(function(){
		setimgtitle('process.png');
		jQuery.get("loadc.php", { file: "process", type: "content" }, function(data){
			jQuery("#contentarea").html(data); 
			fleXcrollTo("mycustomscroll2","1px","1px",false);
			CSBfleXcroll("mycustomscroll2");
	});
		jQuery.get("loadc.php", { file: "process", type: "title" }, function(data){
			settitle(data); });
			
		
			
//		jQuery.get("slideshow.php", function(data){
		jQuery("#leftcontent").html('<img style="margin: 0 0 0 5px; border: 3px solid #A26340;" WIDTH="220" HEIGHT="280" SRC="data/left_process.jpg" />');
//		});
		jQuery("#didiyleoba").html("&nbsp;");
		sitemode('cols');
		CSBfleXcroll("mycustomscroll2");
	});
	jQuery("#nav_keyreferences").click(function(){
		setimgtitle('keyreferences.jpg');
		jQuery.get("loadc.php", { file: "keyreferences", type: "content" }, function(data){
			jQuery("#contentarea").html(data);
			jQuery("#didiyleoba").html("&nbsp;");
			fleXcrollTo("mycustomscroll2","1px","1px",false);
			CSBfleXcroll("mycustomscroll2");
		});
		jQuery.get("loadc.php", { file: "keyreferences", type: "title" }, function(data){
			settitle(data); });
		jQuery("#leftcontent").html('<img style="margin: 0 0 0 5px; border: 3px solid #A26340;" WIDTH="220" HEIGHT="280" SRC="data/left_keyreferences.jpg" />');
		sitemode('cols');
	});
	jQuery("#nav_compproj").click(function(){
		setimgtitle('compproj.png');
		jQuery.get("listlinks3.php", function(data){
			jQuery("#gallnav").html(data); });
		compproj('chandeliers',0);
//		jQuery("#leftcontent").html('<img style="margin: 0 0 0 5px; border: 3px solid #A26340;" WIDTH="220" HEIGHT="280" SRC="data/left_compproj.jpg" />');
//		sitemode('cols');
	});
	jQuery("#nav_about").click(function(){
		setimgtitle('about.png');
		jQuery.get("loadc.php", { file: "about", type: "content" }, function(data){
			jQuery("#contentarea").html(data);
			jQuery("#didiyleoba").html("&nbsp;");
			fleXcrollTo("mycustomscroll2","1px","1px",false);
			CSBfleXcroll("mycustomscroll2");
		});
		jQuery.get("loadc.php", { file: "about", type: "title" }, function(data){
			settitle(data); });
		jQuery("#leftcontent").html('<img style="margin: 0 0 0 5px; border: 3px solid #A26340;" WIDTH="220" HEIGHT="280" SRC="data/left_about.jpg" />');
		sitemode('cols');
	});
	jQuery("#nav_contact").click(function(){
		setimgtitle('contact.png');
		jQuery.get("loadc.php", { file: "contact", type: "content" }, function(data){
			jQuery("#contentarea").html(data);
			jQuery("#didiyleoba").html("&nbsp;");
			
				jQuery.get("loadc.php", { file: "contactform", type: "content" }, function(data){
					jQuery("#contentarea").append(data);  
					fleXcrollTo("mycustomscroll2","1px","600px", true);
					
					CSBfleXcroll("mycustomscroll2");
					fleXcrollTo("mycustomscroll2","1px","1px",false);
				});
		});
			
		
		
		
		jQuery.get("loadc.php", { file: "contact", type: "title" }, function(data){
			settitle(data); });
			
			
		jQuery("#leftcontent").html('<img style="margin: 0 0 0 5px; border: 3px solid #A26340;" WIDTH="220" HEIGHT="280" SRC="data/left_contact.jpg" />');
		sitemode('cols');
	});
var h2img = '<img src="images/thething.gif" style="margin-left:4px;">';
jQuery("#contentarea h2").append(h2img);
jQuery("#leftcontent h2").append(h2img);
});//////////a

function jigar(){
	
	if (byid('name').value == "") {
		
		alert('All fields are required'); return false;
	}	
		
	else if (byid('email').value == "") {
		
		alert('All fields are required'); return false;
	}
	
	else if (byid('text').value == "") {
		
		alert('All fields are required'); return false;
	}
	
	else return true;

}
