// JavaScript Document
var is_IE = 0;
nav  = navigator.userAgent

re = /MSIE/gi
if(nav.match(re)){
	is_IE = 1;
}


var images = new Array();
images[0] = "images/left_back.jpg";
images[1] = "images/right_back.jpg";
images[2] = "images/loading.gif";

function loadPage(page){
	
	document.getElementById('main_frame').src = "scripts/pages.php?p="+page;
	

}

function faq(){
	
	
	document.getElementById('main_frame').src = "scripts/pages.php?faq";
	
	
}

function catalogue(c){
	
	if(!c){
		c = "";
	}
	document.getElementById('main_frame').src = "scripts/catalogue.php?"+c;
	
	
}


function askQuestion(){
	
	
	document.getElementById('main_frame').src = "scripts/ask_question.php?edit=new";
	
	
}

function editDetails(id){
	
	document.getElementById('main_frame').src = "scripts/register.php?edit="+id;
	
	
}

function register(){
	
	document.getElementById('main_frame').src = "scripts/register.php?edit=new";
	
	
	
}

function showTable(){
	
		
		//document.getElementById('left_row').style.backgroundImage = "url("+images[0]+")";
		//document.getElementById('top_row').style.backgroundImage = "url("+images[1]+")";
		
		//document.getElementById('main_table').style.display="block";
		resizeFrame();
		
		setTimeout(hideLoading,2000);
		
	
	
}
function hideLoading(){
	
		document.getElementById('loading').style.display="none";
		resizeFrame();
}


var first_run = 1;

function resizeFrame(){
	

	
	
	h = document.body.clientHeight;
	w = document.body.clientWidth;
	
	
	
	
	this_h = h ;
	
	//alert(h)
	//alert(document.getElementById('main_frame').style.height);
	document.getElementById('main_frame').style.height = ((this_h - 150) > 100)?(this_h - 150):100;
	document.getElementById('right_frame').style.height =((this_h - 150) > 100)?(this_h - 150):100;
	document.getElementById('links_frame').style.height = ((this_h - 150) > 100)?(this_h - 150):100;
	
	try{document.main_frame.checkScroll();}catch(e){}
		
	try{document.links_frame.checkScroll();}catch(e){}
	try{document.right_frame.checkScroll();}catch(e){}
	
	if(first_run == 1){
		
		first_run = 0;
		
	}
	
}

function drawLogo(){
	
	//document.getElementById('logo').innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="180" height="216" id="logo" align="right"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="logo.swf" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="scale" value="allowscale" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ff0000" /><embed src="logo.swf" menu="false" quality="high" scale="allowscale" wmode="transparent" bgcolor="#ff0000" width="180" height="216" name="logo" align="right" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>';
	
	//document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="180" height="216" id="logo" align="right"><param name="allowScriptAccess" value="sameDomain" /><param name="movie" value="logo.swf" /><param name="menu" value="false" /><param name="quality" value="high" /><param name="scale" value="allowscale" /><param name="wmode" value="transparent" /><param name="bgcolor" value="#ff0000" /><embed src="logo.swf" menu="false" quality="high" scale="allowscale" wmode="transparent" bgcolor="#ff0000" width="180" height="216" name="logo" align="right" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
	
	
}








var dis_arr = Array();

function openEditWin(page){
	
			
				if(document.links_frame.document.theForm){
					
						for(i=0;i<document.links_frame.document.theForm.length;i++){
							
							if(document.links_frame.document.theForm[i].disabled == false){
									
									document.links_frame.document.theForm[i].disabled  = true;
									dis_arr.push(document.links_frame.document.theForm[i]);
								
							}
							
						}
				
				}
				
				
				if(document.main_frame.document.theForm){
					
						for(i=0;i<document.main_frame.document.theForm.length;i++){
							
							if(document.main_frame.document.theForm[i].disabled == false){
									
									document.main_frame.document.theForm[i].disabled  = true;
									dis_arr.push(document.main_frame.document.theForm[i]);
								
							}
							
						}
				
				}
				
				
				if(document.right_frame.document.memberForm){
					
						for(i=0;i<document.right_frame.document.memberForm.length;i++){
							
							if(document.right_frame.document.memberForm[i].disabled == false){
									
									document.right_frame.document.memberForm[i].disabled  = true;
									dis_arr.push(document.right_frame.document.memberForm[i]);
								
							}
							
						}
				
				}
				
				
				
				
				
	
				switch(page){
		

					case "page8" : thisPage = document.getElementById('page8');
									docu = "editFrame8";
									pageW =500;
									pageH = 450;
									
									
					break;
					
					
					
				}
			
	
				screenW = document.body.clientWidth;
				screenH = document.body.clientHeight;
				
				
				
				if(screenH < (pageH)){
							
								pageH = screenH - 10;
							
				}
				
							
				
				
				
				
					
				
				leftpos = (screenW - pageW)/ 2;

				toppos = (screenH - pageH)/2;
				
				
				if(leftpos <= 0){
								
					leftpos = 0;
				}
				
				if(toppos <= 0){
								
					toppos = 0;
				}
				
				
				
				
				document.getElementById(docu).style.width = pageW;
				document.getElementById(docu).style.height = pageH;
				thisPage.style.top = toppos;
				
				
				thisPage.style.left = leftpos;
	
					
	
}

function resizePage(page){
	
	
				switch(page){
		

					case "page8" : thisPage = document.getElementById('page8');
									docu = "editFrame8";
									pageW =500;
									pageH = 450;
									
									
					break;
					
					
					
				}
				
				if((document.getElementById(page).style.top != "-2000px")&&(document.getElementById(page).style.top != "")){
	
							screenW = document.body.clientWidth;
							screenH = document.body.clientHeight;
							
							
							if(page == "page8"){
									if(screenH < (pageH)){
									
												pageH = screenH - 10;
												
									}
									document.editFrame8.checkScroll();
							
							}
							
								
							
							leftpos = (screenW - pageW)/ 2;
			
							toppos = (screenH - pageH)/2;
							
							
							if(leftpos <= 0){
											
								leftpos = 10;
							}
							
							if(toppos <= 0){
											
								toppos = 10;
							}
							
							
							
							
							document.getElementById(docu).style.width = pageW;
							document.getElementById(docu).style.height = pageH;
							thisPage.style.top = toppos;
							thisPage.style.left = leftpos;
				
				}
	
	
}






function closePage(page,refreshStr){
				
	
				for(i=0;i<dis_arr.length;i++){
					
					dis_arr[i].disabled = false;
					
				}
				
				dis_arr.length = 0;
				dis_arr = Array();
				
				
				
	
	switch(page){
		

						
		case "page8"  :	document.getElementById('editFrame8').src = ""
						document.getElementById('editFrame8').style.width = "0px";
						document.getElementById('editFrame8').style.height ="0px";
						document.getElementById('page8').style.top = "-2000px";
						document.getElementById('page8').style.left = "-2000px";

						break;
						
		
		
	}
	
	
		
		
	
	
}

