
function ScriptClass(){
	this.activeContent="";
	this.activeWidth="";
	this.timer=0;

	this.getHeight=function(){
		var div=document.createElement("div");
		div.style.position='absolute';
		div.style.width='100px';
		div.style.innerHTML='asd';
		div.style.left='1px';
		div.style.top='1px';
				div.style.backgroundColor='red';
		div.style.height='100%';
		div.id='getHeight';
		document.body.appendChild(div);
		var height=document.getElementById('getHeight').clientHeight;
		var div=document.getElementById('getHeight');
		document.body.removeChild(div);
		return(height);
	
	}
	this.getNum=function(val){
		var num=val;
		return(num.replace("px",""));
		
	}
	this.moveto=function(id,objwidth,objheight){
			clearInterval(timer);
			timer=null;
			timer=0;	
			this.activeContent="";
			

			var topv=this.getNum(document.getElementById(id).style.top);
			var leftv=this.getNum(document.getElementById(id).style.left);	
			
			var addleft=0;
			if(document.getElementById('footer').clientWidth<objwidth)
			addleft=Math.floor((document.getElementById('footer').clientWidth-objwidth)/2);
			else
			addleft=Math.floor((objwidth-document.getElementById('footer').clientWidth)/2);
			
			var addtop=0;
			if(document.getElementById('footer').clientWidth<objheight)
			addtop=0;
			else
			addtop=Math.floor((objheight-this.getHeight())/2);				
			
		  $('#content').animate({
			top: '-'+topv-addtop,
			left: '-'+leftv-addleft
		  }, 500, function(){		  
				jsClass.activeContent=id;
				jsClass.activeWidth=objwidth;
				jsClass.activeHeight=objheight;
				onloadfunc();
		  });		
	}
	this.submitContactForm=function(){
		var contact_name=document.getElementById("contact_name").value;
		var contact_email=document.getElementById("contact_email").value;
		var contact_message=document.getElementById("contact_message").value;	
		
		var message="<center><h4 style='font-family:arial'><br><br>Loading...</h3></center>";						
		showPopup('',message,550,150);		
		
		$.post("ajaxClass.php?action=submitContact", { name:contact_name, email:contact_email, message:contact_message },
		   function(xml){
				$(xml).find("result").each(function(){
					if($(this).text()=="success")
					{
					var message="<center><h4 style='font-family:arial'><br><br>Your message was submitted successfully!<br><br><input type='button' value='OK' style='width:60px; height:30px' onclick='hidePopup()'/></h3></center>";						
					showPopup('Success',message,550,150);
					document.getElementById("contact_name").value='';
					document.getElementById("contact_email").value='';
					document.getElementById("contact_message").value='';					
					}
					else
					{
					var message="<center><h4 style='font-family:arial'><br><br>An Error has occured you while trying to send your message. Please retry.<br><br><input type='button' value='OK' style='width:60px; height:30px' onclick='hidePopup()'/></h3></center>";						
					showPopup('Failed','An error has occured!',550,150);						
					}
				});
				
		   }, "xml");			
	}
	this.submitVideoForm=function(){
		var submit_name=document.getElementById("submit_name").value;
		var submit_address=document.getElementById("submit_address").value;
		var submit_mobile=document.getElementById("submit_mobile").value;
		var submit_email=document.getElementById("submit_email").value;
		var submit_title=document.getElementById("submit_title").value;
		var submit_url=document.getElementById("submit_url").value;
		var agreement=document.getElementById("agreement").checked;
		
		
		
		var message="<center><h4 style='font-family:arial'><br><br>Loading...</h3></center>";						
		showPopup('',message,550,150);		

		var message="<center><h4 style='font-family:arial'><br><br>Video Submission is currently disabled.<br><br><input type='button' value='OK' style='width:60px; height:30px' onclick='hidePopup()'/></h3></center>";
		showPopup("Note",message,500,200,"hidden");	
	}

}

var jsClass=new ScriptClass();


