jQuery(document).ready(function(){
        jQuery("#featab1").click(function() {
                jQuery(".featcont").animate({
                        marginLeft: "0px"
                }, 500);
        });
        jQuery("#featab2").click(function() {
                jQuery(".featcont").animate({
                        marginLeft: "-940px"
                }, 500);
        });
        jQuery("#featab3").click(function() {
                jQuery(".featcont").animate({
                        marginLeft: "-1880px"
                }, 500);
        });
        jQuery("#featab4").click(function() {
                jQuery(".featcont").animate({
                        marginLeft: "-2820px"
                }, 500);
        });        
		
        jQuery("#next1").click(function() {
                jQuery(".featcont").animate({
                        marginLeft: "0px"
                }, 500);
        });
        jQuery("#next2").click(function() {
                jQuery(".featcont").animate({
                        marginLeft: "-990px"
                }, 500);
        });
        jQuery("#next3").click(function() {
                jQuery(".featcont").animate({
                        marginLeft: "-1980px"
                }, 500);
        });
        jQuery("#next4").click(function() {
                jQuery(".featcont").animate({
                        marginLeft: "-2820px"
                }, 500);
        });        
        jQuery("#prev1").click(function() {
                jQuery(".featcont").animate({
                        marginLeft: "0px"
                }, 500);
        });
        jQuery("#prev2").click(function() {
                jQuery(".featcont").animate({
                        marginLeft: "-990px"
                }, 500);
        });
        jQuery("#prev3").click(function() {
                jQuery(".featcont").animate({
                        marginLeft: "-1880px"
                }, 500);
        });
        jQuery("#prev4").click(function() {
                jQuery(".featcont").animate({
                        marginLeft: "-2820px"
                }, 500);
        });    
});

function submit_designfrm()
{
		var title=document.designfrm.title.value;
		var description=document.designfrm.description.value;
		//var tags=document.designfrm.tags.value;
		var file=document.designfrm.file.value;
		var terms=document.designfrm.terms.checked;
		
		var filedata=file.lastIndexOf("\\");
		file=file.substring(filedata+1);
		
		
		
		if(title=="")
		{
				alert("Enter Title");
				document.designfrm.title.focus();
				return false;
		}
		if(description=="")
		{
				alert("Enter Description");
				document.designfrm.description.focus();
				return false;
		}
		if(terms!=1)
		{
				alert("Please Agree to the Terms & Conditions");
				return false;
		}
		$.ajax({
			   type: "POST",
			   url: "form_submit.php",
			   data: "method=design&title="+title+"&description="+description+"&tags="+tags+"&file="+file,
			   success: function(msg){
					if(msg!=-2)
					{
						document.getElementById("design_status").innerHTML="Design Added Successfully";
					}else
					{
						document.getElementById("design_status").innerHTML="Design not added";
					}
			   }
		});
		
		
		
}
function submit_sloganfrm()
{
		var slogan=document.sloganfrm.slogan.value;
		
		if(slogan=="")
		{
				alert("Enter Slogan");
				document.sloganfrm.slogan.focus();
				return false;
		}
		else
		{
				$.ajax({
					   type: "POST",
					   url: "slogan_submit.php",
					   data: "method=design&slogan="+slogan,
					   success: function(msg){
							if(msg==1)
							{
								document.getElementById("slogan_status").innerHTML="Slogan Added Successfully";
							}else
							{
								document.getElementById("slogan_status").innerHTML="Slogan not added";
							}	  
					   }
				});
		}
}

function maxDescription()
{
		var description=document.designfrm.description.value;
		if(description.length>250)
		{
				document.designfrm.description.value=description.substr(0,250);
		}
}






/***********************************************
* Universal Countdown script- © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

function cdLocalTime(container, servermode, offsetMinutes, targetdate, debugmode){
if (!document.getElementById || !document.getElementById(container)) return
this.container=document.getElementById(container)
var servertimestring=(servermode=="server-php")? '<? print date("F d, Y H:i:s", time())?>' : (servermode=="server-ssi")? '<!--#config timefmt="%B %d, %Y %H:%M:%S"--><!--#echo var="DATE_LOCAL" -->' : '<%= Now() %>'
this.localtime=this.serverdate=new Date(servertimestring)
this.targetdate=new Date(targetdate)
this.debugmode=(typeof debugmode!="undefined")? 1 : 0
this.timesup=false
this.localtime.setTime(this.serverdate.getTime()+offsetMinutes*60*1000) //add user offset to server time
this.updateTime()
}

cdLocalTime.prototype.updateTime=function(){
var thisobj=this
this.localtime.setSeconds(this.localtime.getSeconds()+1)
setTimeout(function(){thisobj.updateTime()}, 1000) //update time every second
}

cdLocalTime.prototype.displaycountdown=function(baseunit, functionref){
this.baseunit=baseunit
this.formatresults=functionref
this.showresults()
}

cdLocalTime.prototype.showresults=function(){
var thisobj=this
var debugstring=(this.debugmode)? " "+this.localtime.toLocaleString()+" "+this.targetdate.toLocaleString()+"" : ""

var timediff=(this.targetdate-this.localtime)/1000 //difference btw target date and current date, in seconds
if (timediff<0){ //if time is up
this.timesup=true
this.container.innerHTML=debugstring+this.formatresults()
return
}
var oneMinute=60 //minute unit in seconds
var oneHour=60*60 //hour unit in seconds
var oneDay=60*60*24 //day unit in seconds
var dayfield=Math.floor(timediff/oneDay)
var hourfield=Math.floor((timediff-dayfield*oneDay)/oneHour)
var minutefield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour)/oneMinute)
var secondfield=Math.floor((timediff-dayfield*oneDay-hourfield*oneHour-minutefield*oneMinute))
if (this.baseunit=="hours"){ //if base unit is hours, set "hourfield" to be topmost level
hourfield=dayfield*24+hourfield
dayfield=""
}
else if (this.baseunit=="minutes"){ //if base unit is minutes, set "minutefield" to be topmost level
minutefield=dayfield*24*60+hourfield*60+minutefield
dayfield=hourfield=""
}
else if (this.baseunit=="seconds"){ //if base unit is seconds, set "secondfield" to be topmost level
var secondfield=timediff
dayfield=hourfield=minutefield=""
}
this.container.innerHTML=debugstring+this.formatresults(dayfield, hourfield, minutefield, secondfield)
setTimeout(function(){thisobj.showresults()}, 1000) //update results every second
}

/////PRINT THE TIME LEFT//////////////////////////////
function formatresults2(){
if (this.timesup==false){ //if target date/time not yet met
if(arguments[2] < 10) {
	arguments[2] = "0" + arguments[2];
}
if(arguments[3] < 10) {
	arguments[3] = "0" + arguments[3];
}
var displaystring=+arguments[1]+":"+arguments[2]+":"+arguments[3]
return displaystring
}else{ //else if target date/time met
var displaystring="Too Late!" //Don't display any text
return displaystring
}
}
