//script by pla
var arrMainMenu=new Array("h_info1:info","h_project1:","h_client1:","h_collaborator1:","h_publication1:","h_where1:where","h_workwithus1:workwithus");
var arrSubMenu=new Array('','project','client','collaborator','publication');


function resetMenu(){
	var newName=arrName=subName='';
	for(i=0;i<arrSubMenu1.length;i++){
		newName=(arrSubMenu1[i].substring(0,arrSubMenu1[i].length-1))+'2';
		subName=arrSubMenu1[i].substring(0,arrSubMenu1[i].length-2)
		$('#'+arrSubMenu1[i]).show();
		$('#'+newName).hide();
		$('#'+subName).hide();
	}
	for(i=0;i<arrSubMenu2.length;i++){
		arrName=arrSubMenu2[i].split(':');
		newName=(arrName[0].substring(0,arrName[0].length-1))+'2';
		$('#'+arrSubMenu2[i]).show();
		$('#'+newName).hide();
		$('#'+arrName[1]).hide();
	}
	for(i=0;i<arrSubMenu3.length;i++){
		arrName=arrSubMenu3[i].split(':');
		newName=(arrName[0].substring(0,arrName[0].length-1))+'2';
		$('#'+arrSubMenu3[i]).show();
		$('#'+newName).hide();
		$('#'+arrName[1]).hide();
	}
	for(i=0;i<arrSubMenu4.length;i++){
		arrName=arrSubMenu4[i].split(':');
		newName=(arrName[0].substring(0,arrName[0].length-1))+'2';
		$('#'+arrSubMenu4[i]).show();
		$('#'+newName).hide();
		$('#'+arrName[1]).hide();
	}
	/* sub Project */
	for(i=0;i<arrSubMenuS1.length;i++){
		arrName=arrSubMenuS1[i].split(':');
		newName=(arrName[0].substring(0,arrName[0].length-1))+'2';
		$('#'+arrSubMenuS1[i]).show();
		$('#'+newName).hide();
		$('#'+arrName[1]).hide();
	}
	for(i=0;i<arrSubMenuS2.length;i++){
		arrName=arrSubMenuS2[i].split(':');
		newName=(arrName[0].substring(0,arrName[0].length-1))+'2';
		$('#'+arrSubMenuS2[i]).show();
		$('#'+newName).hide();
		$('#'+arrName[1]).hide();
	}
	for(i=0;i<arrSubMenuS3.length;i++){
		arrName=arrSubMenuS3[i].split(':');
		newName=(arrName[0].substring(0,arrName[0].length-1))+'2';
		$('#'+arrSubMenuS3[i]).show();
		$('#'+newName).hide();
		$('#'+arrName[1]).hide();
	}
	for(i=0;i<arrSubMenuS4.length;i++){
		arrName=arrSubMenuS4[i].split(':');
		newName=(arrName[0].substring(0,arrName[0].length-1))+'2';
		$('#'+arrSubMenuS4[i]).show();
		$('#'+newName).hide();
		$('#'+arrName[1]).hide();
	}
	/*for(i=0;i<arrSubMenuS5.length;i++){
		arrName=arrSubMenuS5[i].split(':');
		newName=(arrName[0].substring(0,arrName[0].length-1))+'2';
		$('#'+arrSubMenuS5[i]).show();
		$('#'+newName).hide();
		$('#'+arrName[1]).hide();
	}*/
	$('#allproject').hide();
}

function showMenu(mid,sid,ssid){
	resetMenu();
	var arrName=newName=newName=newNameS=subCat='';
	for(i=0;i<arrMainMenu.length;i++){
		arrName=arrMainMenu[i].split(':');
		newName=(arrName[0].substring(0,arrName[0].length-1))+'2';
		if(mid==i){
			$('#'+arrName[0]).hide();
			$('#'+newName).show();
			if(arrName[1]!=''){
				$('#boxDefault').hide();
				openmenu(arrName[1]);
			}
			else{
				$('#boxDefault').show();
				$('#'+arrSubMenu[i]).show();
				if(sid!=''){
					$('#'+arrName[0]).show();
					$('#'+newName).hide();
					if(mid==1){
						for(j=0;j<arrSubMenu1.length;j++){
							newNameS=(arrSubMenu1[j].substring(0,arrSubMenu1[j].length-1))+'2';
							subCat=arrSubMenu1[j].substring(0,arrSubMenu1[j].length-2);
							if((sid-1)==j){
								$('#'+arrSubMenu1[j]).hide();
								$('#'+newNameS).show();
								$('#'+subCat).show();
							}else{
								$('#'+arrSubMenu1[j]).show();
								$('#'+newNameS).hide();
								$('#'+subCat).hide();
							}
						}
					}else{
					}
				}
			}
		}else{
			if(arrName[1]!='') $('#'+arrName[1]).hide();
			$('#'+arrName[0]).show();
			$('#'+newName).hide();
			if(arrSubMenu[i]!='') $('#'+arrSubMenu[i]).hide();
		}
	}
	
}

//allzoneweb by architrax

var menu_num = 0;
var menu_now;
var smenu_num = 0;
var smenu_num2 = 0;
var smenu_num3 = 0;
var smenu_num4 = 0;
var smenu_num9 = 0;
var img_now;
var select_num = 0;
var select_num2 = 0;
var select_now1;
var select_now2;
var select_now3;
var select_now4;

//start open menu script
function openmenu(id){
$('#boxDefault').hide();
if (menu_num < 1){
document.getElementById(id).style.display = 'inline';
/*img_now = id+"_01";
document.getElementById(img_now).style.display = 'inline';*/
menu_now = id;
menu_num = 1;
}else{
document.getElementById(menu_now).style.display = 'none';
document.getElementById(id).style.display = 'inline';
/*document.getElementById(img_now).style.display = 'none';
img_now = id+"_01";
document.getElementById(img_now).style.display = 'inline';*/
menu_now = id;
}
}
//end open menu script

//start open submenu project script
function opensubmenu(id){
	$('#boxDefault').hide();
if (smenu_num < 1){
document.getElementById(id).style.display = 'inline';
smenu_num = 1;
}else{
document.getElementById(id).style.display = 'none';
smenu_num = 0;
}
}
//end open submenu project script

//start open submenu client script
function opensubmenu2(id){
	$('#boxDefault').hide();
if (smenu_num2 < 1){
document.getElementById(id).style.display = 'inline';
smenu_num2 = 1;
}else{
document.getElementById(id).style.display = 'none';
smenu_num2 = 0;
}
}
//end open submenu client script

//start open submenu collaborator script
function opensubmenu3(id){
	$('#boxDefault').hide();
if (smenu_num3 < 1){
document.getElementById(id).style.display = 'inline';
smenu_num3 = 1;
}else{
document.getElementById(id).style.display = 'none';
smenu_num3 = 0;
}
}
//end open submenu collaborator script

//start open submenu project2 script
function opensubmenu4(id){
	$('#boxDefault').hide();
if (smenu_num4 < 1){
document.getElementById(id).style.display = 'inline';
smenu_num4 = 1;
}else{
document.getElementById('type1').style.display = 'none';
document.getElementById('type2').style.display = 'none';
document.getElementById('type3').style.display = 'none';
document.getElementById('type4').style.display = 'none';
document.getElementById('type5').style.display = 'none';
document.getElementById(id).style.display = 'inline';
}
}
//end open submenu project2 script

//start open submenu publication script
function opensubmenu9(id){
	$('#boxDefault').hide();
if (smenu_num9 < 1){
document.getElementById(id).style.display = 'inline';
smenu_num9 = 1;
}else{
document.getElementById(id).style.display = 'none';
smenu_num9 = 0;
}
}
//end open submenu publication script

//start open img script
function openimg(id){
document.getElementById(img_now).style.display = 'none';
document.getElementById(id).style.display = 'inline';
smenu_num = 1;
img_now = id;
}
//end open img script

//start selectmenu script
function selectmenu(menu1,menu2,content,ptype){
	openmenu(content);
	var txtShow=txtHide='';
	//alert(menu1.substring(0,2))
	if(menu1.substring(0,2)=='p_' || menu1.substring(0,2)=='ap'){
		txtShow=arrSubMenu1[ptype-1].split(':');
		txtHide=(txtShow[0].substring(0,txtShow[0].length-1))+'2';
		$('#'+txtShow[0]).show();
		$('#'+txtHide).hide();
	}
	else if(menu1.substring(0,2)=='c_'){
		txtShow=arrMainMenu[2].split(':');
		txtHide=(txtShow[0].substring(0,txtShow[0].length-1))+'2';
		$('#'+txtShow[0]).show();
		$('#'+txtHide).hide();
	}
	else if(menu1.substring(0,2)=='co'){
		txtShow=arrMainMenu[3].split(':');
		txtHide=(txtShow[0].substring(0,txtShow[0].length-1))+'2';
		$('#'+txtShow[0]).show();
		$('#'+txtHide).hide();
	}
	else if(menu1.substring(0,2)=='pu'){
		txtShow=arrMainMenu[3].split(':');
		txtHide=(txtShow[0].substring(0,txtShow[0].length-1))+'2';
		$('#'+txtShow[0]).show();
		$('#'+txtHide).hide();
	}
	
	
	
	if (select_num < 1){
	document.getElementById(menu1).style.display = 'none';
	document.getElementById(menu2).style.display = 'inline';
	select_now1 = menu1;
	select_now2 = menu2;
	select_num = 1;
	}else{
	document.getElementById(select_now1).style.display = 'inline';
	document.getElementById(select_now2).style.display = 'none';
	document.getElementById(menu1).style.display = 'none';
	document.getElementById(menu2).style.display = 'inline';
	select_now1 = menu1;
	select_now2 = menu2;
	}
}
//end selectmenu script

//start selectmenu2 script
function selectmenu2(menu1,menu2,id){
opensubmenu4(id);
if (select_num2 < 1){
document.getElementById(menu1).style.display = 'none';
document.getElementById(menu2).style.display = 'inline';
select_now3 = menu1;
select_now4 = menu2;
select_num2 = 1;
}else{
document.getElementById(select_now3).style.display = 'inline';
document.getElementById(select_now4).style.display = 'none';
document.getElementById(menu1).style.display = 'none';
document.getElementById(menu2).style.display = 'inline';
select_now3 = menu1;
select_now4 = menu2;
}
}
//end selectmenu script

//start go to client script
function gotoc(menu1,menu2,content){
openmenu(content);
document.getElementById('client').style.display = 'inline';
document.getElementById(select_now1).style.display = 'inline';
document.getElementById(select_now2).style.display = 'none';
document.getElementById(menu1).style.display = 'none';
document.getElementById(menu2).style.display = 'inline';
select_now1 = menu1;
select_now2 = menu2;
smenu_num2 = 1;
}
//end go to client script

//start go to collaborator script
function gotoco(menu1,menu2,content){
openmenu(content);
document.getElementById('collaborator').style.display = 'inline';
document.getElementById(select_now1).style.display = 'inline';
document.getElementById(select_now2).style.display = 'none';
document.getElementById(menu1).style.display = 'none';
document.getElementById(menu2).style.display = 'inline';
select_now1 = menu1;
select_now2 = menu2;
smenu_num3 = 1;
}
//end go to collaborator script

//start go to publication script
function gotopu(menu1,menu2,content){
openmenu(content);
document.getElementById('publication').style.display = 'inline';
document.getElementById(select_now1).style.display = 'inline';
document.getElementById(select_now2).style.display = 'none';
document.getElementById(menu1).style.display = 'none';
document.getElementById(menu2).style.display = 'inline';
select_now1 = menu1;
select_now2 = menu2;
smenu_num9 = 1;
}
//end go to publication script


function showImgL(img,id,box){
	//var newimg="img/"+img+".jpg";
	if(box){
		document.getElementById(box+id).src="img/"+img;
	}else{
		document.getElementById("imgL"+id).src="img/"+img;
	}
}
function contact(){
	tb_show('', 'ajaxcontactform/contact.html?height=310&width=300', '');
}

function projectDetail(n1,n2,n,type){
	showMenu(1,type,'');
	selectmenu(n1,n2,n,type);
}

function designer(id){
	tb_show('', 'designer.php?id='+id+'&height=410&width=525', '');
}

function fnth(){
	tb_show('', 'th.html?height=310&width=300', '');
}